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.