Search code examples
terraform

How to iterate n times in one list


I want to perform something like this:

rules = [
for i in somethings : {
//actions
},
for s in others : {
//actions
}
]

I need to get in result one list with the result of few iterated loops. The flatten logic I think.


Solution

  • It really needs flatten

    rules = flatten([[
    for i in somethings : {
    //actions
    }],
    [for s in others : {
    //actions
    }
    ],])