You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you cut and past this module to create multiple sets of network security policies and don't change the key name for your NSGs, the module will create both NSGs, then crash on any subsequent runs.
This TF should reproduce the error:
module "test1" {
source = "github.com/oracle-terraform-modules/terraform-oci-tdf-network-security?ref=v0.9.7"
default_compartment_id = oci_identity_compartment.this.id
vcn_id = oci_core_vcn.this.id
security_lists = {}
nsgs = {
test = {
....Trimmed for brevity, but the content here doesn't matter as long as it's valid...
}
}
}
module "test2" {
source = "github.com/oracle-terraform-modules/terraform-oci-tdf-network-security?ref=v0.9.7"
default_compartment_id = oci_identity_compartment.this.id
vcn_id = oci_core_vcn.this.id
security_lists = {}
nsgs = {
test = {
....Trimmed for brevity, but the content here doesn't matter as long as it's valid...
}
}
}
you can terraform apply this with no errors, but on subsequent runs, you get the following:
Error: Duplicate object key
on .terraform/modules/test1/main_nsg.tf line 20, in locals:
20: remote_nsg_ids = { for i in data.oci_core_network_security_groups.this.network_security_groups : i.display_name => i.id }
|----------------
| i.display_name is "test"
Two different items produced the key "test" in this 'for' expression. If
duplicates are expected, use the ellipsis (...) after the value expression to
enable grouping by key.
Error: Duplicate object key
on .terraform/modules/test1/main_nsg.tf line 20, in locals:
20: remote_nsg_ids = { for i in data.oci_core_network_security_groups.this.network_security_groups : i.display_name => i.id }
|----------------
| i.display_name is "test"
Two different items produced the key "test" in this 'for' expression. If
duplicates are expected, use the ellipsis (...) after the value expression to
enable grouping by key.
The text was updated successfully, but these errors were encountered:
If you cut and past this module to create multiple sets of network security policies and don't change the key name for your NSGs, the module will create both NSGs, then crash on any subsequent runs.
This TF should reproduce the error:
you can
terraform apply
this with no errors, but on subsequent runs, you get the following:The text was updated successfully, but these errors were encountered: