-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Description
We are using a local variable list/map to add Vlans to a Ethernet Network Group Policy .
(intersight_fabric_eth_network_group_policy).
This source local variable list/map is also used to create multiple other resources (ACI vlans, ACI Static ports, Kubernetes NetworkAttachementDefinitions.
Using join/tolist to create the strings of Vlans that needs to be added.
Vlans will therefore not contain ranges (eg: 180,1140,1141)
Because Intersight automatically changes these to ranges when it can, Terraform always reports a change and wants to re-apply a change after every run, even if zero change applied to repo.
Is it possible to add some smarts to the Intersight provider to correlate ranges vs list of vlans?
Thanks.
Terraform-provider-intersight version
Terraform v1.8.3
- Using previously-installed hashicorp/kubernetes v2.33.0
- Using previously-installed ciscodevnet/intersight v1.0.58
- Using previously-installed ciscodevnet/aci v2.15.0
Configuration file
locals {
vlans-csv = <<-CSV
vlan-id,descr,namespaces,clusters,epg-dn,ucsfi
1140,NONPRD-BUILD-WIN,openshiftvm-ns,imaginary-cluster|diaocv,uni/tn-NONPRD/ap-BUILD/epg-WIN,TTQSW|TMPSW
1141,NONPRD-BUILD-LINUX,openshiftvm-ns,imaginary-cluster|diaocv,uni/tn-NONPRD/ap-BUILD/epg-LINUX,TTQSW
CSV
vlans = csvdecode(local.vlans-csv)
######################################################
}
resource "intersight_fabric_eth_network_group_policy" "TCF-DIA-OCP-VLANs" {
name = "TF:TCF-DIA-OCP-VLAN-UPLINK"
description = "Terraform Managed"
dynamic "tags" {
for_each = local.tags
content {
key = tags.key
value = tags.value
}
}
vlan_settings {
allowed_vlans = join(",", tolist([for v in local.vlans : v.vlan-id if contains(split("|", lower(vlan.ucsfi)), "ttqsw")]))
object_type = "fabric.VlanSettings"
}
organization {
object_type = "organization.Organization"
moid = data.intersight_organization_organization.INTERSIGHT-ORG.moid
}
}
Actual output (Attach screenshots if applicable)
# intersight_fabric_eth_network_group_policy.TCF-DIA-OCP-VLANs[0] will be updated in-place
~ resource "intersight_fabric_eth_network_group_policy" "TCF-DIA-OCP-VLANs" {
id = "673b94b06f6269310189f53a"
name = "TF:TCF-DIA-OCP-VLAN-UPLINK"
tags = [
{
additional_properties = null
key = "Automation"
value = "Terraform"
},
]
~ vlan_settings = [
~ {
~ allowed_vlans = "1140-1141" -> "1140,1141"
# (6 unchanged attributes hidden)
},
]
# (16 unchanged attributes hidden)
}
Related issues/PRs
none
Suggest a fix
none
Metadata
Metadata
Assignees
Labels
No labels