Skip to content

Commit

Permalink
Merge branch 'main' into utd
Browse files Browse the repository at this point in the history
  • Loading branch information
rrahimm authored Nov 4, 2024
2 parents d6bc220 + 3b55348 commit 272197d
Show file tree
Hide file tree
Showing 6 changed files with 337 additions and 194 deletions.
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
## 0.1.0 (unreleased version)
## 0.1.1 (unreleased)

- Add support for variables to Secure App Hosting feature Template
- rename "sdwan_profile_parcels.tf" to "sdwan_features.tf"
- provide default value for name if not explicitly set for sdwan_system_basic_feature, sdwan_system_omp_feature, sdwan_system_performance_monitoring_feature, sdwan_system_security_feature, sdwan_system_snmp_feature and sdwan_transport_wan_vpn_feature
- simplify default feature name from "profile_name-feature_name" to "feature_name"
- add support for sdwan_policy_object_feature_profile resource
- add support for sdwan_policy_object_class_map resource
- add support for sdwan_policy_object_data_ipv4_prefix_list resource
- add support for sdwan_policy_object_data_ipv6_prefix_list resource
- add support for sdwan_policy_object_expanded_community_list resource
- add support for sdwan_policy_object_extended_community_list resource
- add support for sdwan_policy_object_ipv4_prefix_list resource
- add support for sdwan_policy_object_ipv6_prefix_list resource
- add support for sdwan_policy_object_mirror resource
- add support for sdwan_policy_object_policer resource
- add support for sdwan_policy_object_tloc_list resource
- add support for variables to Secure App Hosting feature Template

## 0.1.0

Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@ module "sdwan" {
| [sdwan_other_feature_profile.other_feature_profile](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/other_feature_profile) | resource |
| [sdwan_other_thousandeyes_feature.other_thousandeyes_feature](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/other_thousandeyes_feature) | resource |
| [sdwan_policer_policy_object.policer_policy_object](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policer_policy_object) | resource |
| [sdwan_policy_object_class_map.policy_object_class_map](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_class_map) | resource |
| [sdwan_policy_object_data_ipv4_prefix_list.policy_object_data_ipv4_prefix_list](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_data_ipv4_prefix_list) | resource |
| [sdwan_policy_object_data_ipv6_prefix_list.policy_object_data_ipv6_prefix_list](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_data_ipv6_prefix_list) | resource |
| [sdwan_policy_object_expanded_community_list.policy_object_expanded_community_list](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_expanded_community_list) | resource |
| [sdwan_policy_object_extended_community_list.policy_object_extended_community_list](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_extended_community_list) | resource |
| [sdwan_policy_object_feature_profile.policy_object_feature_profile](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_feature_profile) | resource |
| [sdwan_policy_object_ipv4_prefix_list.policy_object_ipv4_prefix_list](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_ipv4_prefix_list) | resource |
| [sdwan_policy_object_ipv6_prefix_list.policy_object_ipv6_prefix_list](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_ipv6_prefix_list) | resource |
| [sdwan_policy_object_mirror.policy_object_mirror](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_mirror) | resource |
| [sdwan_policy_object_policer.policy_object_policer](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_policer) | resource |
| [sdwan_policy_object_tloc_list.policy_object_tloc_list](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/policy_object_tloc_list) | resource |
| [sdwan_preferred_color_group_policy_object.preferred_color_group_policy_object](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/preferred_color_group_policy_object) | resource |
| [sdwan_qos_map_policy_definition.qos_map_policy_definition](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/qos_map_policy_definition) | resource |
| [sdwan_region_list_policy_object.region_list_policy_object](https://registry.terraform.io/providers/CiscoDevNet/sdwan/latest/docs/resources/region_list_policy_object) | resource |
Expand Down
209 changes: 209 additions & 0 deletions sdwan_classic_policy_objects.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
resource "sdwan_application_list_policy_object" "application_list_policy_object" {
for_each = { for p in try(local.policy_objects.application_lists, {}) : p.name => p }
name = each.value.name
# entries = [for e in try(each.value.entries, []) : {
entries = [for e in concat([for app in try(each.value.applications, []) : { "application" : app }], [for fam in try(each.value.application_families, []) : { "application_family" : fam }]) : {
application = try(e.application, null)
application_family = try(e.application_family, null)
}]
}

resource "sdwan_as_path_list_policy_object" "as_path_list_policy_object" {
for_each = { for p in try(local.policy_objects.as_path_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.as_paths, []) : {
as_path = e
}]
}

resource "sdwan_class_map_policy_object" "class_map_policy_object" {
for_each = { for p in try(local.policy_objects.class_maps, {}) : p.name => p }
name = each.value.name
queue = each.value.queue
}

resource "sdwan_color_list_policy_object" "color_list_policy_object" {
for_each = { for p in try(local.policy_objects.color_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.colors, []) : {
color = e
}]
}

resource "sdwan_standard_community_list_policy_object" "standard_community_list_policy_object" {
for_each = { for p in try(local.policy_objects.standard_community_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.standard_communities, []) : {
community = e
}]
}

resource "sdwan_data_ipv4_prefix_list_policy_object" "data_ipv4_prefix_list_policy_object" {
for_each = { for p in try(local.policy_objects.ipv4_data_prefix_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.prefixes, []) : {
prefix = e
}]
}

resource "sdwan_expanded_community_list_policy_object" "expanded_community_list_policy_object" {
for_each = { for p in try(local.policy_objects.expanded_community_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.expanded_communities, []) : {
community = e
}]
}

resource "sdwan_extended_community_list_policy_object" "extended_community_list_policy_object" {
for_each = { for p in try(local.policy_objects.extended_community_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.extended_communities, []) : {
community = e
}]
}

resource "sdwan_policer_policy_object" "policer_policy_object" {
for_each = { for p in try(local.policy_objects.policers, {}) : p.name => p }
name = each.value.name
burst = each.value.burst_bytes
exceed_action = each.value.exceed_action
rate = each.value.rate_bps
}

resource "sdwan_ipv4_prefix_list_policy_object" "ipv4_prefix_list_policy_object" {
for_each = { for p in try(local.policy_objects.ipv4_prefix_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.entries, []) : {
prefix = e.prefix
ge = try(e.ge, null)
le = try(e.le, null)
}]
}

resource "sdwan_mirror_policy_object" "mirror_policy_object" {
for_each = { for p in try(local.policy_objects.mirror_lists, {}) : p.name => p }
name = each.value.name
remote_destination_ip = each.value.remote_destination_ip
source_ip = each.value.source_ip
}

resource "sdwan_site_list_policy_object" "site_list_policy_object" {
for_each = { for p in try(local.policy_objects.site_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in concat(try(each.value.site_ids, []), [for r in try(each.value.site_id_ranges, []) : "${r.from}-${r.to}"]) : {
site_id = e
}]
}

resource "sdwan_sla_class_policy_object" "sla_class_policy_object" {
for_each = { for p in try(local.policy_objects.sla_classes, {}) : p.name => p }
app_probe_class_id = try(sdwan_app_probe_class_policy_object.app_probe_class_policy_object[each.value.app_probe_class].id, null)
app_probe_class_version = try(sdwan_app_probe_class_policy_object.app_probe_class_policy_object[each.value.app_probe_class].version, null)
name = each.value.name
jitter = try(each.value.jitter_ms, null)
latency = try(each.value.latency_ms, null)
loss = try(each.value.loss_percentage, null)
fallback_best_tunnel_criteria = try(each.value.fallback_best_tunnel_criteria, null)
fallback_best_tunnel_jitter = try(each.value.fallback_best_tunnel_jitter, null)
fallback_best_tunnel_latency = try(each.value.fallback_best_tunnel_latency, null)
fallback_best_tunnel_loss = try(each.value.fallback_best_tunnel_loss, null)
}

resource "sdwan_tloc_list_policy_object" "tloc_list_policy_object" {
for_each = { for p in try(local.policy_objects.tloc_lists, {}) : p.name => p }
name = each.value.name
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_vpn_list_policy_object" "vpn_list_policy_object" {
for_each = { for p in try(local.policy_objects.vpn_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in concat(try(each.value.vpn_ids, []), [for r in try(each.value.vpn_id_ranges, []) : "${r.from}-${r.to}"]) : {
vpn_id = e
}]
}

resource "sdwan_app_probe_class_policy_object" "app_probe_class_policy_object" {
for_each = { for p in try(local.policy_objects.app_probe_classes, {}) : p.name => p }
name = each.value.name
forwarding_class = each.value.forwarding_class
mappings = [for e in try(each.value.mappings, []) : {
color = e.color
dscp = try(e.dscp, null)
}]
}

resource "sdwan_data_ipv6_prefix_list_policy_object" "data_ipv6_prefix_list_policy_object" {
for_each = { for p in try(local.policy_objects.ipv6_data_prefix_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.prefixes, []) : {
prefix = e
}]
}

resource "sdwan_ipv6_prefix_list_policy_object" "ipv6_prefix_list_policy_object" {
for_each = { for p in try(local.policy_objects.ipv6_prefix_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.entries, []) : {
prefix = e.prefix
ge = try(e.ge, null)
le = try(e.le, null)
}]
}

resource "sdwan_preferred_color_group_policy_object" "preferred_color_group_policy_object" {
for_each = { for p in try(local.policy_objects.preferred_color_groups, {}) : p.name => p }
name = each.value.name
primary_color_preference = join(" ", [for c in each.value.primary_colors : c])
primary_path_preference = try(each.value.primary_path, null)
secondary_color_preference = join(" ", [for c in try(each.value.secondary_colors, []) : c])
secondary_path_preference = try(each.value.secondary_path, null)
tertiary_color_preference = join(" ", [for c in try(each.value.tertiary_colors, []) : c])
tertiary_path_preference = try(each.value.tertiary_path, null)
}

resource "sdwan_region_list_policy_object" "region_list_policy_object" {
for_each = { for p in try(local.policy_objects.region_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in toset(concat(try(each.value.region_ids, []), [for r in try(each.value.region_id_ranges, []) : "${r.from}-${r.to}"])) : {
region_id = e
}]
}


resource "sdwan_zone_list_policy_object" "zone_list_policy_object" {
for_each = { for p in try(local.policy_objects.zones, {}) : p.name => p }
name = each.value.name
entries = concat(
[for e in try(each.value.vpn_ids, []) : {
vpn = e
}],
[for e in try(each.value.interfaces, []) : {
interface = e
}]
)
}

resource "sdwan_data_fqdn_prefix_list_policy_object" "fqdn_prefix_list_policy_object" {
for_each = { for p in try(local.policy_objects.fqdn_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in try(each.value.fqdns, []) : {
fqdn = e
}]

}

resource "sdwan_local_application_list_policy_object" "local_application_list_policy_object" {
for_each = { for p in try(local.policy_objects.local_application_lists, {}) : p.name => p }
name = each.value.name
entries = [for e in concat([for app in try(each.value.applications, []) : { "application" : app }], [for fam in try(each.value.application_families, []) : { "application_family" : fam }]) : {
application = try(e.application, null)
application_family = try(e.application_family, null)
}]
}

6 changes: 6 additions & 0 deletions sdwan_feature_profiles.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ resource "sdwan_transport_feature_profile" "transport_feature_profile" {
name = each.value.name
description = try(each.value.description, "")
}

resource "sdwan_policy_object_feature_profile" "policy_object_feature_profile" {
count = contains(keys(local.feature_profiles), "policy_object_profile") ? 1 : 0
name = try(local.feature_profiles.policy_object_profile.name, "Policy_Profile_Global")
description = try(local.feature_profiles.policy_object_profile.description, "")
}
Loading

0 comments on commit 272197d

Please sign in to comment.