Skip to content

Commit

Permalink
refactor: Update Meraki organization network configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-humphries committed Jun 10, 2024
1 parent de4ade7 commit ffad0f2
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions meraki_organization.tf
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
data "meraki_organizations" "organizations" {
output "meraki_domains_organizations" {
description = "Output the value of local.meraki.domains.organizations for debugging"
value = local.meraki.domains.organizations
}

locals {
organization_map = { for organization in data.meraki_organizations.organizations.items : organization.name => organization.id }
networks = flatten([
for org in try(local.meraki.domains.organizations, []) : [
for network in try(org.networks, []) : {
key = format("%s/%s", org.name, network.name)
organization_id = local.organization_map[org.name]
name = try(network.name, local.defaults.meraki.organizations.networks.name)
notes = try(network.notes, local.defaults.meraki.organizations.networks.notes)
product_types = try(network.product_types, local.defaults.meraki.organizations.networks.product_types)
tags = try(network.tags, local.defaults.meraki.organizations.networks.tags)
time_zone = try(network.timezone, local.defaults.meraki.organizations.networks.timezone)
}
]
])
output "organization_map" {
description = "Output the value of local.organization_map for debugging"
value = local.organization_map
}

output "networks" {
description = "Output the value of local.networks for debugging"
value = local.networks
}

resource "meraki_networks" "networks" {
Expand Down

0 comments on commit ffad0f2

Please sign in to comment.