Special list syntax in Terraform resources

Hi there,

I stumbled over the following list syntax in the GitHub Terraform Provider, but could not find an official reference to it. Especially, I would like to know how it is possible to loop over a list to define the resource, e.g. via some for_each-like building block. Can anyone help?

resource "github_team_members" "some_team_members" {
  team_id  = github_team.some_team.id

  members {
    username = "SomeUser"
    role     = "maintainer"

  members {
    username = "AnotherUser"
    role     = "member"

Example from here.

Thanks in advance for some hints!

Best regards

Members are being represented here by repeated nested blocks.

When you have a need to dynamically define some number of these, you need the language construct described at https://www.terraform.io/language/expressions/dynamic-blocks

Hi @maxb , thanks! That is exactly what I’ve been looking for!