generated from Azure/terraform-azurerm-avm-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
locals.tf
189 lines (175 loc) · 7.4 KB
/
locals.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
locals {
location = var.location != null ? var.location : data.azurerm_resource_group.rg.location
role_definition_resource_substring = "/providers/Microsoft.Authorization/roleDefinitions"
secrets = try(jsondecode(azapi_resource.container_app.body).properties.secrets, null) != null ? [
for secret in jsondecode(azapi_resource.container_app.body).properties.secrets : {
name = secret.name
value = secret.value
identity = secret.identity
key_vault_secret_id = secret.keyVaultUrl
}
] : null
templates = {
revision_suffix = jsondecode(azapi_resource.container_app.body).properties.template.revisionSuffix
max_replicas = jsondecode(azapi_resource.container_app.body).properties.template.scale.maxReplicas
min_replicas = jsondecode(azapi_resource.container_app.body).properties.template.scale.minReplicas
init_container = try(jsondecode(azapi_resource.container_app.body).properties.template.initContainers, null) != null ? [
for ic in jsondecode(azapi_resource.container_app.body).properties.template.initContainers :
{
name = ic.name
image = ic.image
cpu = ic.resources.cpu
memory = ic.resources.memory
command = ic.command
args = ic.args
env = ic.env != null ? [
for e in ic.env :
{
name = e.name
value = e.value
secret_name = e.secretRef
}
] : []
volume_mounts = ic.volumeMounts != null ? [
for vm in ic.volumeMounts :
{
name = vm.volumeName
mount_path = vm.mountPath
sub_path = vm.subPath
}
] : []
}
] : null
container = [
for c in jsondecode(azapi_resource.container_app.body).properties.template.containers :
{
name = c.name
image = c.image
cpu = c.resources.cpu
memory = c.resources.memory
liveness_probe = c.probes != null ? [
for probe in c.probes : {
failure_count_threshold = probe.failureThreshold
initial_delay = probe.initialDelaySeconds
interval_seconds = probe.periodSeconds
host = probe.host
path = probe.path
port = probe.port
termination_grace_period_seconds = probe.termination_grace_period_seconds
timeout = probe.timeoutSeconds
transport = probe.transport
header = probe.httpHeaders != null ? [
for header in probe.httpHeaders : {
name = header.name
value = header.value
}
] : null
} if try(probe.type == "Liveness", null)
] : null
readiness_probe = c.probes != null ? [
for probe in c.probes : {
failure_count_threshold = probe.failureThreshold
interval_seconds = probe.periodSeconds
host = probe.host
path = probe.path
port = probe.port
success_count_threshold = probe.successThreshold
timeout = probe.timeoutSeconds
transport = probe.transport
header = probe.httpHeaders != null ? [
for header in probe.httpHeaders : {
name = header.name
value = header.value
}
] : null
} if try(probe.type == "Readiness", null)
] : null
startup_probe = c.probes != null ? [
for probe in c.probes : {
failure_count_threshold = probe.failureThreshold
interval_seconds = probe.periodSeconds
host = probe.host
path = probe.path
port = probe.port
termination_grace_period_seconds = probe.termination_grace_period_seconds
timeout = probe.timeoutSeconds
transport = probe.transport
header = probe.httpHeaders != null ? [
for header in probe.httpHeaders : {
name = header.name
value = header.value
}
] : null
} if try(probe.type == "Startup", null)
] : null
command = c.command
args = c.args
env = c.env != null ? [
for e in c.env :
{
name = e.name
value = e.value
secret_name = e.secretRef
}
] : []
volume_mounts = c.volumeMounts != null ? [
for vm in c.volumeMounts :
{
name = vm.volumeName
mount_path = vm.mountPath
sub_path = vm.subPath
}
] : []
}
]
azure_queue_scale_rules = try(jsondecode(azapi_resource.container_app.body).properties.scale.rules, null) != null ? [
for rule in jsondecode(azapi_resource.container_app.body).properties.scale.rules : {
name = rule.name
queue_name = try(rule.azureQueue.queueName, null)
queue_length = try(rule.azureQueue.queueLength, null)
authentication = [
for auth in try(rule.azureQueue.auth, []) : {
secret_name = auth.secretRef
trigger_parameter = auth.triggerParameter
}
]
} if try(rule.azureQueue, null) != null
] : null
custom_scale_rules = try(jsondecode(azapi_resource.container_app.body).properties.scale.rules, null) != null ? [
for rule in jsondecode(azapi_resource.container_app.body).properties.scale.rules : {
name = rule.name
custom_rule_type = try(rule.custom.metadata.type, null)
authentication = [
for auth in try(rule.custom.auth, []) : {
secret_name = auth.secretRef
trigger_parameter = auth.triggerParameter
}
]
} if try(rule.custom, null) != null
] : null
http_scale_rules = try(jsondecode(azapi_resource.container_app.body).properties.scale.rules, null) != null ? [
for rule in jsondecode(azapi_resource.container_app.body).properties.scale.rules : {
name = rule.name
concurrent_requests = try(rule.http.metadata.concurrentRequests, null)
authentication = [
for auth in try(rule.http.auth, []) : {
secret_name = auth.secretRef
trigger_parameter = auth.triggerParameter
}
]
} if try(rule.http, null) != null
] : null
tcp_scale_rules = try(jsondecode(azapi_resource.container_app.body).properties.scale.rules, null) != null ? [
for rule in jsondecode(azapi_resource.container_app.body).properties.scale.rules : {
name = rule.name
concurrent_requests = try(rule.tcp.metadata.concurrentRequests, null)
authentication = [
for auth in try(rule.tcp.auth, []) : {
secret_name = auth.secretRef
trigger_parameter = auth.triggerParameter
}
]
} if try(rule.tcp, null) != null
] : null
}
}