diff --git a/README.md b/README.md index 2aaf855..c1bc393 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/ndo_deploy_templates.tf b/ndo_deploy_templates.tf index 522c1d9..79aa138 100644 --- a/ndo_deploy_templates.tf +++ b/ndo_deploy_templates.tf @@ -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, diff --git a/ndo_schemas.tf b/ndo_schemas.tf index 5ef9c6f..059ae8d 100644 --- a/ndo_schemas.tf +++ b/ndo_schemas.tf @@ -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 : [