Hey there,
I’m having some issues looping over accessing an attribute of one of my modules.
I’ve created a module called oncall
which has some outputs defined
output "team_id" {
value = pagerduty_team.team.id
}
output "team_name" {
value = var.team_name
}
I’m running this module:
module "oncall" {
for_each = local.teams
source = "./modules/oncall"
team_name = each.value.name
}
And I’m trying to reference the output from that instance in another module instance to build a map:
module "users" {
source = "./modules/users"
teams = { for team in module.oncall[*] : team.team_name => team.team_id }
}
However, when I do so I get an error:
This object does not have an attribute named "team_name".
What should I try here? That error implies to me that the output is not defined, but I can see that it is.
Thanks!