Skip to content

Commit

Permalink
add mso_schema_site_external_epg (#42)
Browse files Browse the repository at this point in the history
* add support for site specific ext epg settings

* comment out l3out schema template and on_apic

* typo

* update doc
  • Loading branch information
juchowan authored Aug 30, 2024
1 parent 4272f0a commit 09c8ea5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ $ export TF_CLI_ARGS_apply="-parallelism=1"
| [mso_schema_site_bd_l3out.schema_site_bd_l3out](https://registry.terraform.io/providers/CiscoDevNet/mso/1.2.2/docs/resources/schema_site_bd_l3out) | resource |
| [mso_schema_site_bd_subnet.schema_site_bd_subnet](https://registry.terraform.io/providers/CiscoDevNet/mso/1.2.2/docs/resources/schema_site_bd_subnet) | resource |
| [mso_schema_site_contract_service_graph.schema_site_contract_service_graph](https://registry.terraform.io/providers/CiscoDevNet/mso/1.2.2/docs/resources/schema_site_contract_service_graph) | resource |
| [mso_schema_site_external_epg.schema_site_external_epg](https://registry.terraform.io/providers/CiscoDevNet/mso/1.2.2/docs/resources/schema_site_external_epg) | resource |
| [mso_schema_site_external_epg_selector.schema_site_external_epg_selector](https://registry.terraform.io/providers/CiscoDevNet/mso/1.2.2/docs/resources/schema_site_external_epg_selector) | resource |
| [mso_schema_site_service_graph.schema_site_service_graph](https://registry.terraform.io/providers/CiscoDevNet/mso/1.2.2/docs/resources/schema_site_service_graph) | resource |
| [mso_schema_site_vrf.schema_site_vrf](https://registry.terraform.io/providers/CiscoDevNet/mso/1.2.2/docs/resources/schema_site_vrf) | resource |
Expand Down
1 change: 1 addition & 0 deletions ndo_deploy_templates.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "mso_schema_template_deploy_ndo" "template" {
mso_schema_template_external_epg_contract.schema_template_external_epg_contract,
mso_schema_template_external_epg_subnet.schema_template_external_epg_subnet,
mso_schema_template_external_epg_selector.schema_template_external_epg_selector,
mso_schema_site_external_epg.schema_site_external_epg,
mso_schema_site_external_epg_selector.schema_site_external_epg_selector,
mso_schema_template_service_graph.schema_template_service_graph,
mso_schema_site_service_graph.schema_site_service_graph,
Expand Down
38 changes: 38 additions & 0 deletions ndo_schemas.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,44 @@ resource "mso_schema_template_external_epg" "schema_template_external_epg" {
]
}

locals {
external_epgs_sites = flatten([
for schema in local.schemas : [
for template in try(schema.templates, []) : [
for epg in try(template.external_endpoint_groups, []) : [
for site in try(epg.sites, []) : {
key = try(site.l3out.name, null) != null ? "${schema.name}/${template.name}/${epg.name}/${site.name}/${site.l3out.name}" : "${schema.name}/${template.name}/${epg.name}/${site.name}"
schema_id = mso_schema.schema[schema.name].id
site_id = var.manage_sites ? mso_site.site[site.name].id : data.mso_site.template_site[site.name].id
template_name = template.name
external_epg_name = epg.name
l3out_name = try(site.l3out.name, null)
# l3out_template_name = try(site.l3out.template, null)
# l3out_schema_id = try(site.l3out.schema, null) != null ? mso_schema.schema[site.l3out.schema].id : null
# l3out_on_apic = try(site.l3out.on_apic, null)
}
]
]
]
])
}

resource "mso_schema_site_external_epg" "schema_site_external_epg" {
for_each = { for site in local.external_epgs_sites : site.key => site }
schema_id = each.value.schema_id
site_id = each.value.site_id
template_name = each.value.template_name
external_epg_name = each.value.external_epg_name
l3out_name = each.value.l3out_name
# l3out_template_name = each.value.l3out_template
# l3out_schema_id = each.value.l3out_schema
# l3out_on_apic = each.value.l3out_on_apic

depends_on = [
mso_schema_template_external_epg.schema_template_external_epg,
]
}

locals {
external_epgs_contracts = flatten([
for schema in local.schemas : [
Expand Down

0 comments on commit 09c8ea5

Please sign in to comment.