Open
Description
Expected Behavior
github_team_membership
should be created successfully for the team that was just created in the same terraform apply
.
Actual Behavior
The github_team_membership
resource fails to create, because the provider cannot find the newly created team, resulting in a 404 error.
Terraform Version
Terraform 1.8.5
linux_amd64, darwin_arm64
Affected Resource(s)
github_team
github_team_membership
Terraform Configuration Files
variable "teams" {
type = map(object({
name = string
description = optional(string)
members = optional(list(string))
parent = optional(string)
}))
}
locals {
team_members = flatten([
for team_name, team in var.teams : [
for member in team.members != null ? team.members : [] : {
team = team_name
member = member
}
]
])
}
resource "github_team" "this" {
for_each = var.teams
name = each.key
description = each.value.description
parent_team_id = each.value.parent
privacy = "closed"
}
resource "github_team_membership" "this" {
for_each = { for tm in local.team_members : "${tm.team}-${tm.member}" => tm }
team_id = github_team.this[each.value.team].id
username = each.value.member
depends_on = [
github_team.this
]
}
Steps to Reproduce
terraform apply
Debug Output
08:55:05.815 STDOUT terraform: github_team.this["it"]: Creation complete after 35s [id=13271003]
08:55:26.811 STDERR terraform: │ Error: strconv.ParseInt: parsing "it": invalid syntaxGET https://api.github.com/orgs/XXX/teams/it: 404 Not Found []
Panic Output
Code of Conduct
- I agree to follow this project's Code of Conduct