-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathiosxe_service_templates.tf
More file actions
85 lines (76 loc) · 4.04 KB
/
Copy pathiosxe_service_templates.tf
File metadata and controls
85 lines (76 loc) · 4.04 KB
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
locals {
service_template_name = flatten([
for device in local.devices : [
for service_template in try(local.device_config[device.name].service_templates, []) : {
key = format("%s/%s", device.name, service_template.name)
device = device.name
name = service_template.name
inactivity_timer = try(service_template.inactivity_timer, null)
inactivity_timer_probe = try(service_template.inactivity_timer_probe, null)
vlan = try(service_template.vlan, null)
voice_vlan = try(service_template.voice_vlan, null)
linksec_policy = try(service_template.linksec_policy, null)
sgt = try(service_template.sgt, null)
absolute_timer = try(service_template.absolute_timer, null)
description = try(service_template.description, null)
tunnel_capwap_name = try(service_template.tunnel_capwap_name, null)
vnid = try(service_template.vnid, null)
redirect_url = try(service_template.redirect_url, null)
redirect_url_match_acl = try(service_template.redirect_url_match_acl, null)
dns_acl_preauth = try(service_template.dns_acl_preauth, null)
redirect_append_client_mac = try(service_template.redirect_append_client_mac, null)
redirect_append_switch_mac = try(service_template.redirect_append_switch_mac, null)
redirect_url_match_action = try(service_template.redirect_url_match_action, null)
service_policy_qos_input = try(service_template.service_policy_qos_input, null)
service_policy_qos_output = try(service_template.service_policy_qos_output, null)
mdns_service_policy = try(service_template.mdns_service_policy, null)
# Lists
access_groups = try(length(service_template.access_groups) == 0, true) ? null : [for group_name in service_template.access_groups : {
name = group_name
}
]
interface_templates = try(length(service_template.interface_templates) == 0, true) ? null : [for template_name in service_template.interface_templates : {
name = template_name
}
]
tags = try(length(service_template.tags) == 0, true) ? null : [for tag_name in service_template.tags : {
name = tag_name
}
]
}
]
])
}
resource "iosxe_service_template" "service_template" {
for_each = { for e in local.service_template_name : e.key => e }
device = each.value.device
name = each.value.name
inactivity_timer = each.value.inactivity_timer
inactivity_timer_probe = each.value.inactivity_timer_probe
vlan = each.value.vlan
voice_vlan = each.value.voice_vlan
linksec_policy = each.value.linksec_policy
sgt = each.value.sgt
absolute_timer = each.value.absolute_timer
description = each.value.description
tunnel_capwap_name = each.value.tunnel_capwap_name
vnid = each.value.vnid
redirect_url = each.value.redirect_url
redirect_url_match_acl = each.value.redirect_url_match_acl
dns_acl_preauth = each.value.dns_acl_preauth
redirect_append_client_mac = each.value.redirect_append_client_mac
redirect_append_switch_mac = each.value.redirect_append_switch_mac
redirect_url_match_action = each.value.redirect_url_match_action
service_policy_qos_input = each.value.service_policy_qos_input
service_policy_qos_output = each.value.service_policy_qos_output
mdns_service_policy = each.value.mdns_service_policy
# Lists
access_groups = each.value.access_groups
interface_templates = each.value.interface_templates
tags = each.value.tags
depends_on = [
iosxe_vlan.vlan,
iosxe_access_list_standard.access_list_standard,
iosxe_access_list_extended.access_list_extended
]
}