Iterating List of lists getting null value in terraform
Input Variable
appr = {
"product1" = {WO = ["6470"], RO = ["6471","5538"]},
"product2" = {RO = ["6472"]}
}
Error:
│ Error: Iteration over null value
│
│ on ../../modules/sa_pc/main.tf line 15, in locals:
│ 14: for co, coo in clsan : [
│ 15: for applo in coo : [
│ 16: for op in ( co == "RO" ? ["READ","DESCRIBE"] : ["WRITE"] ) : {
│ 17: oper = op
│ 18:
│ 19: appid_lo = applo
│ 20: opic-name = opi
│ 21: process = co
│ 22: }
│ 23: ]
│ 24: ]
│
│ A null value cannot be used as the collection in a 'for' expression.
Throwing error as null value @ coo, when tried on terraform console getting desire output but failing with terraform plan.
Where am going wrong ?
Note: coo Is iterating lists using for loop
Tried this
loca开发者_Go百科ls {
acl_out = flatten([
for opi, clsan in var.appr : [
for co, coo in clsan : [
for applo in coo : [
for op in ( co == "RO" ? ["READ","DESCRIBE"] : ["WRITE"]) : {
oper = op
appid_lo = applo
opic-name = opi
process = co
}
]
]
]
])
}
精彩评论