generated from Azure/terraform-azurerm-avm-template
-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cdn_frontdoor_rules.tf
258 lines (229 loc) · 10.3 KB
/
main.cdn_frontdoor_rules.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
resource "azurerm_cdn_frontdoor_rule_set" "rule_set" {
for_each = var.front_door_rule_sets
cdn_frontdoor_profile_id = azapi_resource.front_door_profile.id
name = each.value
}
resource "azurerm_cdn_frontdoor_rule" "rules" {
for_each = var.front_door_rules
cdn_frontdoor_rule_set_id = azurerm_cdn_frontdoor_rule_set.rule_set[each.value.rule_set_name].id
name = each.value.name
order = each.value.order
behavior_on_match = each.value.behavior_on_match
actions {
dynamic "request_header_action" {
for_each = each.value.actions.request_header_actions
content {
header_action = request_header_action.value.header_action
header_name = request_header_action.value.header_name
value = request_header_action.value.value
}
}
dynamic "response_header_action" {
for_each = each.value.actions.response_header_actions
content {
header_action = response_header_action.value.header_action
header_name = response_header_action.value.header_name
value = response_header_action.value.value
}
}
dynamic "route_configuration_override_action" {
for_each = each.value.actions.route_configuration_override_actions
content {
cache_behavior = route_configuration_override_action.value.cache_behavior
cache_duration = route_configuration_override_action.value.cache_duration
cdn_frontdoor_origin_group_id = route_configuration_override_action.value.set_origin_groupid == true ? azurerm_cdn_frontdoor_origin_group.origin_groups[each.value.origin_group_key].id : null
compression_enabled = route_configuration_override_action.value.compression_enabled
forwarding_protocol = route_configuration_override_action.value.forwarding_protocol
query_string_caching_behavior = route_configuration_override_action.value.query_string_caching_behavior
query_string_parameters = route_configuration_override_action.value.query_string_parameters
}
}
dynamic "url_redirect_action" {
for_each = each.value.actions.url_redirect_actions
content {
destination_hostname = url_redirect_action.value.destination_hostname
redirect_type = url_redirect_action.value.redirect_type
destination_fragment = url_redirect_action.value.destination_fragment
destination_path = url_redirect_action.value.destination_path
query_string = url_redirect_action.value.query_string
redirect_protocol = url_redirect_action.value.redirect_protocol
}
}
dynamic "url_rewrite_action" {
for_each = each.value.actions.url_rewrite_actions
content {
destination = url_rewrite_action.value.destination
source_pattern = url_rewrite_action.value.source_pattern
preserve_unmatched_path = url_rewrite_action.value.preserve_unmatched_path
}
}
}
conditions {
dynamic "client_port_condition" {
for_each = each.value.conditions.client_port_conditions
content {
operator = client_port_condition.value.operator
match_values = client_port_condition.value.match_values
negate_condition = client_port_condition.value.negate_condition
}
}
dynamic "cookies_condition" {
for_each = each.value.conditions.cookies_conditions
content {
cookie_name = cookies_condition.value.cookie_name
operator = cookies_condition.value.operator
match_values = cookies_condition.value.match_values
negate_condition = cookies_condition.value.negate_condition
transforms = cookies_condition.value.transforms
}
}
dynamic "host_name_condition" {
for_each = each.value.conditions.host_name_conditions
content {
operator = host_name_condition.value.operator
match_values = host_name_condition.value.match_values
negate_condition = host_name_condition.value.negate_condition
transforms = host_name_condition.value.transforms
}
}
dynamic "http_version_condition" {
for_each = each.value.conditions.http_version_conditions
content {
match_values = http_version_condition.value.match_values
negate_condition = http_version_condition.value.negate_condition
operator = http_version_condition.value.operator
}
}
dynamic "is_device_condition" {
for_each = each.value.conditions.is_device_conditions
content {
match_values = is_device_condition.value.match_values
negate_condition = is_device_condition.value.negate_condition
operator = is_device_condition.value.operator
}
}
dynamic "post_args_condition" {
for_each = each.value.conditions.post_args_conditions
content {
operator = post_args_condition.value.operator
post_args_name = post_args_condition.value.post_args_name
match_values = post_args_condition.value.match_values
negate_condition = post_args_condition.value.negate_condition
transforms = post_args_condition.value.transforms
}
}
dynamic "query_string_condition" {
for_each = each.value.conditions.query_string_conditions
content {
operator = query_string_condition.value.operator
match_values = query_string_condition.value.match_values
negate_condition = query_string_condition.value.negate_condition
transforms = query_string_condition.value.transforms
}
}
dynamic "remote_address_condition" {
for_each = each.value.conditions.remote_address_conditions
content {
match_values = remote_address_condition.value.match_values
negate_condition = remote_address_condition.value.negate_condition
operator = remote_address_condition.value.operator
}
}
dynamic "request_body_condition" {
for_each = each.value.conditions.request_body_conditions
content {
match_values = request_body_condition.value.match_values
operator = request_body_condition.value.operator
negate_condition = request_body_condition.value.negate_condition
transforms = request_body_condition.value.transforms
}
}
dynamic "request_header_condition" {
for_each = each.value.conditions.request_header_conditions
content {
header_name = request_header_condition.value.header_name
operator = request_header_condition.value.operator
match_values = request_header_condition.value.match_values
negate_condition = request_header_condition.value.negate_condition
transforms = request_header_condition.value.transforms
}
}
dynamic "request_method_condition" {
for_each = each.value.conditions.request_method_conditions
content {
match_values = request_method_condition.value.match_values
negate_condition = request_method_condition.value.negate_condition
operator = request_method_condition.value.operator
}
}
dynamic "request_scheme_condition" {
for_each = each.value.conditions.request_scheme_conditions
content {
match_values = request_scheme_condition.value.match_values
negate_condition = request_scheme_condition.value.negate_condition
operator = request_scheme_condition.value.operator
}
}
dynamic "request_uri_condition" {
for_each = each.value.conditions.request_uri_conditions
content {
operator = request_uri_condition.value.operator
match_values = request_uri_condition.value.match_values
negate_condition = request_uri_condition.value.negate_condition
transforms = request_uri_condition.value.transforms
}
}
dynamic "server_port_condition" {
for_each = each.value.conditions.server_port_conditions
content {
match_values = server_port_condition.value.match_values
operator = server_port_condition.value.operator
negate_condition = server_port_condition.value.negate_condition
}
}
dynamic "socket_address_condition" {
for_each = each.value.conditions.socket_address_conditions
content {
match_values = socket_address_condition.value.match_values
negate_condition = socket_address_condition.value.negate_condition
operator = socket_address_condition.value.operator
}
}
dynamic "ssl_protocol_condition" {
for_each = each.value.conditions.ssl_protocol_conditions
content {
match_values = ssl_protocol_condition.value.match_values
negate_condition = ssl_protocol_condition.value.negate_condition
operator = ssl_protocol_condition.value.operator
}
}
dynamic "url_file_extension_condition" {
for_each = each.value.conditions.url_file_extension_conditions
content {
match_values = url_file_extension_condition.value.match_values
operator = url_file_extension_condition.value.operator
negate_condition = url_file_extension_condition.value.negate_condition
transforms = url_file_extension_condition.value.transforms
}
}
dynamic "url_filename_condition" {
for_each = each.value.conditions.url_filename_conditions
content {
operator = url_filename_condition.value.operator
match_values = url_filename_condition.value.match_values
negate_condition = url_filename_condition.value.negate_condition
transforms = url_filename_condition.value.transforms
}
}
dynamic "url_path_condition" {
for_each = each.value.conditions.url_path_conditions
content {
operator = url_path_condition.value.operator
match_values = url_path_condition.value.match_values
negate_condition = url_path_condition.value.negate_condition
transforms = url_path_condition.value.transforms
}
}
}
depends_on = [azurerm_cdn_frontdoor_origin_group.origin_groups, azurerm_cdn_frontdoor_origin.origins]
}