forked from netascode/terraform-sdwan-nac-sdwan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdwan_policy_objects.tf
111 lines (102 loc) · 5.31 KB
/
sdwan_policy_objects.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
resource "sdwan_policy_object_tloc_list" "policy_object_tloc_list" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.tloc_lists, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
entries = [for e in try(each.value.tlocs, []) : {
color = e.color
encapsulation = e.encapsulation
tloc_ip = e.tloc_ip
preference = try(e.preference, null)
}]
}
resource "sdwan_policy_object_policer" "policy_object_policer" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.policers, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
entries = [{
burst_bytes = each.value.burst_bytes
exceed_action = each.value.exceed_action
rate_bps = each.value.rate_bps
}]
}
resource "sdwan_policy_object_mirror" "policy_object_mirror" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.mirror_lists, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
entries = [{
remote_destination_ip = each.value.remote_destination_ip
source_ip = each.value.source_ip
}]
}
resource "sdwan_policy_object_ipv4_prefix_list" "policy_object_ipv4_prefix_list" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.ipv4_prefix_lists, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
entries = [for e in try(each.value.entries, []) : {
ipv4_address = split("/", e.prefix)[0]
ipv4_prefix_length = split("/", e.prefix)[1]
le = try(e.le, null)
ge = try(e.ge, null)
}]
}
resource "sdwan_policy_object_ipv6_prefix_list" "policy_object_ipv6_prefix_list" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.ipv6_prefix_lists, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
entries = [for e in try(each.value.entries, []) : {
ipv6_address = split("/", e.prefix)[0]
ipv6_prefix_length = split("/", e.prefix)[1]
le = try(e.le, null)
ge = try(e.ge, null)
}]
}
resource "sdwan_policy_object_extended_community_list" "policy_object_extended_community_list" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.extended_community_lists, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
entries = [for e in try(each.value.extended_communities, []) : {
extended_community = e
}]
}
resource "sdwan_policy_object_expanded_community_list" "policy_object_expanded_community_list" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.expanded_community_lists, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
expanded_community_lists = each.value.expanded_communities
}
resource "sdwan_policy_object_data_ipv4_prefix_list" "policy_object_data_ipv4_prefix_list" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.ipv4_data_prefix_lists, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
entries = [for e in try(each.value.prefixes, []) : {
ipv4_address = split("/", e)[0]
ipv4_prefix_length = split("/", e)[1]
}]
}
resource "sdwan_policy_object_data_ipv6_prefix_list" "policy_object_data_ipv6_prefix_list" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.ipv6_data_prefix_lists, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
entries = [for e in try(each.value.prefixes, []) : {
ipv6_address = split("/", e)[0]
ipv6_prefix_length = split("/", e)[1]
}]
}
resource "sdwan_policy_object_class_map" "policy_object_class_map" {
for_each = { for p in try(local.feature_profiles.policy_object_profile.class_maps, {}) : p.name => p }
name = each.value.name
description = try(each.value.description, null)
feature_profile_id = sdwan_policy_object_feature_profile.policy_object_feature_profile[0].id
entries = [{
queue = each.value.queue
}]
}