I have two vars:
map(list(string))
tree = {
core = ["fks", "nkz", "fksb"]
leaf = ["bar", "real]
}
map(string)
env_branch = {
development = "dev"
production = "prod"
}
The result should look like this:
acc_branch = {
fks = "master"
nkz = "master"
fksb = "master"
bar = "dev"
real = "dev"
}
In my locals I would like to do something like this:
locals {
acc_branch_pairs = flatten([
for acc in values(var.tree): {
if acc == var.tree["core"]
acc = acc
branch = var.env_branch["production"]
else
acc = acc
branch = var.env_branch["development"]
}
])
}
Not sure how to proceed with IF-ELSE statements when using for loops in tf. Any suggestion would be appreciated.