Skip to content

TF tries to remove members of the subteam from the parent team even though they dont exist in it. #1193

@cuotos

Description

@cuotos

Terraform Version

Terraform v1.2.3
on darwin_amd64

Affected Resource(s)

Please list the resources as a list, for example:

  • github_team_members

Terraform Configuration Files

resource "github_team" "parent" {
  name    = "parent_team"
  privacy = "closed"
}
resource "github_team_members" "parent" {
  team_id = github_team.parent.id
  members {
    username = "userA"
    role     = "maintainer"
  }
}
resource "github_team" "child" {
  name           = "child_team"
  parent_team_id = github_team.parent.id
  privacy        = "closed"
}
resource "github_team_members" "child" {
  team_id = github_team.child.id
  members {
    username = "userB"
    role     = "maintainer"
  }
}  

Expected Behavior

after apply, no changes are required

Actual Behavior

  ~ resource "github_team_members" "parent" {
        id      = "xxxx"
        # (2 unchanged attributes hidden)

      - members {
          - role     = "maintainer" -> null
          - username = "userB" -> null
        }
        # (1 unchanged block hidden)
    }

User B is not in the parent team, only the sub team, but TF wants to remove it from the parent which cannot be done and the apply times out. The Github api returns a list of all sub team members when you request all users in the parent team.

https://docs.github.com/en/rest/teams/members#list-team-members
Team members will include the members of child teams.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedStatus: Up for grabsIssues that are ready to be worked on by anyoneType: FeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions