Hey There,
Naive to the OCI terraform. Running below code to get OCIDs for a list of NSG display names. I am getting some strings but not ocid. Not sure what I’m doing wrong
variable “list” {
type=“list”
}
data “oci_core_network_security_groups” “test_network_security_groups” {
compartment_id = "ocid1.compartment.oc1..xxxxxxxxxxxxxx"
#for_each = var.list
count = length(var.list)
display_name = var.list[count.index]
}
output “nsgids” {
value = {
ocid = data.oci_core_network_security_groups.test_network_security_groups.*.id
}
}
Output:
Changes to Outputs:
- nsgids = {
- ocid = [
- “CoreNetworkSecurityGroupsDataSource-669665417”,
- “CoreNetworkSecurityGroupsDataSource-3932909720”,
- “CoreNetworkSecurityGroupsDataSource-3951049207”,
]
}
- ocid = [
Input:
var.list
Enter a value: [“NSG-PSFTHPRD-MT-DB”,“ATOM_ADB_NSG”,“NSG_MCSENG_AUTOCODEGENERATOR01”]