Reputation: 3310
I am trying to manage my github organisation using terraform
and wanted to implement a team structure.
I have defined the team structure in a map as below:
variable "teams" {
description = "Map of teams with members"
type = "map"
default = {
"TeamA" = ["abc", "xyz", "pqr", "mno"]
"TeamB" = ["abc", "xyz", "mno"]
"TeamC" = ["pqr"]
}
}
I am able to create these teams using following resource code:
resource "github_team" "sub-teams" {
count = "${length(keys(var.teams))}"
name = "${element(keys(var.teams), count.index)} Team"
description = "${element(keys(var.teams), count.index)} team"
privacy = "closed"
}
Now the ask is loop over keys of map and add corresponding team members to the respective teams. How should I achieve this requirement?
I referred this one, but looks like it has both the list constant as against of this said scenario.
Upvotes: 3
Views: 3784
Reputation: 353
Nested Maps are not yet supported by terraform.
You will need to use the variables inside the map rather using arrays. Below link will take you to the git issue page.
https://github.com/hashicorp/terraform/issues/2114
Upvotes: 1