Hi all,
i would like to have the dependenciens resolved by terraform in the following code:
module "nsg" {
for_each = { for nsg in var.nsg_configs : nsg.name => nsg if nsg.name != "" }
source = "./modules/nsg"
name = each.value.name
security_rules = each.value.security_rules
}
module "ovm_public" {
for_each = { for ovm in var.ovm_public_configs : ovm.name => ovm if ovm.name != "" }
source = "./modules/ovm"
nsg_id = [for n in each.value.nsg : module.nsg[n].nsg_id[n]]
...
}
ovm_public_configs = [{ name = "myovm", nsg = ["test1"], .... }]
nsg_configs = [{ name = "test1", security_rules = [{ direction = "ingress", ... }]}]
Maybe a solution can be move the module “nsg”, inside the module “ovm_public”, but i don’t think is the best solution. Can you suggest an idea?
Thanks,
K