Repository navigation
Closed
Description
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
$ terraform apply
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
- I agree to follow this project's Code of Conduct
Reacted by Lucas Ventura, Matt Copperwaite, BB-adamjones, Samuel and danieldklc
Metadata
Metadata
Assignees
Labels
Type: BugSomething isn't working as documented
Type
Projects
- StatusShow more project fields✅ Done
- StatusShow more project fieldsDone
Activity
[-][BUG]: Inconsistent result when moving from github_organization_custom_role to github_organization_repository_role[/-][+][BUG]: Inconsistent result when moving from `github_organization_custom_role` to `github_organization_repository_role`[/+]nicolas-fidel-wmx commentedon Oct 27, 2025
I have exactly the same problem.
faust64 commentedon Dec 4, 2025
getting this too with v6.8.3, against GHES 3.17.7
deiga commentedon Dec 4, 2025
Hey @vmvarela 👋
Thanks for reporting this!
That definitely sounds wrong and needs fixing.
We're currently focused on getting v7 of the provider released (which upgrades the Github SDK) and have limited capacity to address other issues.
Once we're done, we'll look at prioritising the bugs and issues 😊
In the meantime, if you'd like to take a stab at it and submit a PR, we'd appreciate that a lot!
stevehipwell commentedon Dec 4, 2025
I suspect that this is due to the pattern of re-reading the resource after it's been created.