3

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.