-
Notifications
You must be signed in to change notification settings - Fork 41
/
main.tf
101 lines (84 loc) · 1.74 KB
/
main.tf
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
output "null_out" {
value = null
}
output "number_out" {
value = 0
}
output "bool_out" {
value = true
}
output "string_out" {
value = "hello world"
}
output "tuple_out" {
value = [1, 2, 3]
}
output "str_object_out" {
value = {
hello: "hallo"
goodbye: "ha det"
}
}
locals {
a_key = "hello"
a_value = -1
a_list = [1, 2, 3]
a_list_of_maps = [
{
x: [1, 2]
y: [3, 4]
},
{
x: [5, 6]
y: [7, 8]
}
]
}
output "static_index_out" {
value = local.a_list[1]
}
output "dynamic_index_out" {
value = local.a_list[local.a_value]
}
output "complex_object_out" {
value = {
a_tuple: ["a", "b", "c"]
an_object: {
literal_key: 1
another_literal_key = 2
"yet_another_literal_key": local.a_value
# This doesn't translate correctly
# (local.a_key) = 4
}
ambiguous_for: {
"for" = 1
}
}
}
output "simple_template" {
value = "${local.a_value}"
}
output "quoted_template" {
value = "The key is ${local.a_key}"
}
output "heredoc" {
value = <<END
This is also a template.
So we can output the key again ${local.a_key}
END
}
output "for_tuple" {
value = [for key, value in ["a", "b"] : "${key}:${value}:${local.a_value}" if key != 0]
}
output "for_tuple_value_only" {
value = [for value in ["a", "b"] : "${value}:${local.a_value}"]
}
output "for_object" {
value = {for key, value in ["a", "b"] : key => "${value}:${local.a_value}" if key != 0}
}
output "relative_traversal_attr" {
value = local.a_list_of_maps[0].x
}
output "relative_traversal_index" {
value = local.a_list_of_maps[0]["x"]
}