-
Notifications
You must be signed in to change notification settings - Fork 41
/
main.pp
63 lines (63 loc) · 1.24 KB
/
main.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
output nullOut {
value = null
}
output numberOut {
value = 0
}
output boolOut {
value = true
}
output stringOut {
value = "hello world"
}
output tupleOut {
value = [1, 2, 3]
}
output strObjectOut {
value = {
hello: "hallo"
goodbye: "ha det"
}
}
aKey = "hello"
aValue = -1
aList = [1, 2, 3]
output staticIndexOut {
value = aList[1]
}
output dynamicIndexOut {
value = aList[aValue]
}
output complexObjectOut {
value = {
a_tuple: ["a", "b", "c"]
an_object: {
literal_key: 1
another_literal_key = 2
"yet_another_literal_key": aValue
# This doesn't translate correctly
# (local.a_key) = 4
}
ambiguous_for: {
"for" = 1
}
}
}
output quotedTemplate {
value = "The key is ${aKey}"
}
output heredoc {
value = <<END
This is also a template.
So we can output the key again ${aKey}
END
}
output forTuple {
value = [for key, value in ["a", "b"] : "${key}:${value}:${aValue}" if key != 0]
}
output forTupleValueOnly {
value = [for value in ["a", "b"] : "${value}:${aValue}"]
}
output forObject {
value = {for key, value in ["a", "b"] : key => "${value}:${aValue}" if key != 0}
}