Expected Behavior
The github_organization_repository_role resource should be created successfully on the first terraform apply and tracked correctly in state, allowing subsequent applies to be idempotent.
Actual Behavior
On the first apply, Terraform fails with: Provider produced inconsistent result after apply: Root object was present, but now absent. Despite the error, the role is actually created in GitHub.
A second apply fails with: 422 Name has already been taken
because Terraform attempts to recreate the role it failed to record in state.
Terraform Version
Terraform v1.11.1
on darwin_arm64
- provider registry.terraform.io/integrations/github v6.7.0
Affected Resource(s)
- github_organization_repository_role
Terraform Configuration Files
repository_roles = {
"codeowner" = {
description = "Maintain plus bypass branch protection and resolve scanning alerts"
base_role = "maintain"
permissions = [
"bypass_branch_protection",
"delete_alerts_code_scanning",
"resolve_secret_scanning_alerts",
"view_secret_scanning_alerts",
]
}
"developer" = {
description = "Write plus view secret scanning alerts"
base_role = "write"
permissions = ["view_secret_scanning_alerts"]
}
}
resource "github_organization_repository_role" "this" {
for_each = var.repository_roles
name = each.key
description = each.value.description
base_role = each.value.base_role
permissions = each.value.permissions
}
Steps to Reproduce
Debug Output
Panic Output
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to module.org.github_organization_repository_role.this["developer"], provider "provider[\"registry.terraform.io/integrations/github\"]" produced an unexpected new value: Root object was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: error creating GitHub organization repository role (prisamedia-training-sandbox/developer): POST https://api.github.com/orgs/prisamedia-training-sandbox/custom-repository-roles: 422 Name has already been taken []
│
│ with module.org.github_organization_repository_role.this["developer"],
│ on ../../modules/github-organization/main.tf line 98, in resource "github_organization_repository_role" "this":
│ 98: resource "github_organization_repository_role" "this" {
│
╵
Code of Conduct
Expected Behavior
The
github_organization_repository_roleresource should be created successfully on the first terraform apply and tracked correctly in state, allowing subsequent applies to be idempotent.Actual Behavior
On the first apply, Terraform fails with: Provider produced inconsistent result after apply: Root object was present, but now absent. Despite the error, the role is actually created in GitHub.
A second apply fails with: 422 Name has already been taken
because Terraform attempts to recreate the role it failed to record in state.
Terraform Version
Terraform v1.11.1
on darwin_arm64
Affected Resource(s)
Terraform Configuration Files
Steps to Reproduce
Debug Output
Panic Output
Code of Conduct