forked from netascode/terraform-sdwan-nac-sdwan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdwan_features_service.tf
108 lines (105 loc) · 5.78 KB
/
sdwan_features_service.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
resource "sdwan_service_tracker_group_feature" "service_tracker_group_feature" {
for_each = {
for tracker_item in flatten([
for profile in try(local.feature_profiles.service_profiles, []) : [
for tracker in try(profile.ipv4_tracker_groups, []) : {
profile = profile
tracker = tracker
}
]
])
: "${tracker_item.profile.name}-${tracker_item.tracker.name}" => tracker_item
}
name = each.value.tracker.name
description = try(each.value.tracker.description, null)
feature_profile_id = sdwan_service_feature_profile.service_feature_profile[each.value.profile.name].id
tracker_boolean = try(each.value.tracker.tracker_boolean, null)
tracker_boolean_variable = try("{{${each.value.tracker.tracker_boolean_variable}}}", null)
tracker_elements = try(length(each.value.tracker.trackers) == 0, true) ? null : [for t in each.value.tracker.trackers : {
tracker_id = sdwan_service_tracker_feature.service_tracker_feature["${each.value.profile.name}-${t}"].id
}]
}
resource "sdwan_service_tracker_feature" "service_tracker_feature" {
for_each = {
for tracker_item in flatten([
for profile in try(local.feature_profiles.service_profiles, []) : [
for tracker in try(profile.ipv4_trackers, []) : {
profile = profile
tracker = tracker
}
]
])
: "${tracker_item.profile.name}-${tracker_item.tracker.name}" => tracker_item
}
name = each.value.tracker.name
description = try(each.value.tracker.description, null)
feature_profile_id = sdwan_service_feature_profile.service_feature_profile[each.value.profile.name].id
endpoint_api_url = try(each.value.tracker.endpoint_url, null)
endpoint_api_url_variable = try("{{${each.value.tracker.endpoint_url_variable}}}", null)
endpoint_ip = try(each.value.tracker.endpoint_ip, null)
endpoint_ip_variable = try("{{${each.value.tracker.endpoint_ip_variable}}}", null)
endpoint_tracker_type = "static-route"
interval = try(each.value.tracker.interval, null)
interval_variable = try("{{${each.value.tracker.interval_variable}}}", null)
multiplier = try(each.value.tracker.multiplier, null)
multiplier_variable = try("{{${each.value.tracker.multiplier_variable}}}", null)
port = try(each.value.tracker.endpoint_port, null)
port_variable = try("{{${each.value.tracker.endpoint_port_variable}}}", null)
protocol = try(each.value.tracker.endpoint_protocol, null)
protocol_variable = try("{{${each.value.tracker.endpoint_protocol_variable}}}", null)
threshold = try(each.value.tracker.threshold, null)
threshold_variable = try("{{${each.value.tracker.threshold_variable}}}", null)
tracker_name = try(each.value.tracker.tracker_name, null)
tracker_name_variable = try("{{${each.value.tracker.tracker_name_variable}}}", null)
tracker_type = "endpoint"
}
resource "sdwan_service_object_tracker_group_feature" "service_object_tracker_group_feature" {
for_each = {
for tracker_item in flatten([
for profile in try(local.feature_profiles.service_profiles, []) : [
for tracker in try(profile.object_tracker_groups, []) : {
profile = profile
tracker = tracker
}
]
])
: "${tracker_item.profile.name}-${tracker_item.tracker.name}" => tracker_item
}
name = each.value.tracker.name
description = try(each.value.tracker.description, null)
feature_profile_id = sdwan_service_feature_profile.service_feature_profile[each.value.profile.name].id
object_tracker_id = try(each.value.tracker.id, null)
object_tracker_id_variable = try("{{${each.value.tracker.id_variable}}}", null)
reachable = try(each.value.tracker.tracker_boolean, null)
reachable_variable = try("{{${each.value.tracker.tracker_boolean_variable}}}", null)
tracker_elements = try(length(each.value.tracker.trackers) == 0, true) ? null : [for t in each.value.tracker.trackers : {
object_tracker_id = sdwan_service_object_tracker_feature.service_object_tracker_feature["${each.value.profile.name}-${t}"].id
}]
}
resource "sdwan_service_object_tracker_feature" "service_object_tracker_feature" {
for_each = {
for tracker_item in flatten([
for profile in try(local.feature_profiles.service_profiles, []) : [
for tracker in try(profile.object_trackers, []) : {
profile = profile
tracker = tracker
}
]
])
: "${tracker_item.profile.name}-${tracker_item.tracker.name}" => tracker_item
}
name = each.value.tracker.name
description = try(each.value.tracker.description, null)
feature_profile_id = sdwan_service_feature_profile.service_feature_profile[each.value.profile.name].id
object_tracker_type = each.value.tracker.type
interface = try(each.value.tracker.interface_name, null)
interface_variable = try("{{${each.value.tracker.interface_name_variable}}}", null)
object_tracker_id = try(each.value.tracker.id, null)
object_tracker_id_variable = try("{{${each.value.tracker.id_variable}}}", null)
route_ip = try(each.value.tracker.route_ip, null)
route_ip_variable = try("{{${each.value.tracker.route_ip_variable}}}", null)
route_mask = try(each.value.tracker.route_mask, null)
route_mask_variable = try("{{${each.value.tracker.route_mask_variable}}}", null)
vpn = try(each.value.tracker.vpn_id, null)
vpn_variable = try("{{${each.value.tracker.vpn_id_variable}}}", null)
}