Repository navigation
Description
Expected Behavior
When creating github_actions_environment_variable and github_environment_secret I expect terraform to track the state and create the resources successfully.
note:
since I could not find a better place in the form to put this: I assume this bug is highly related to #2843
Actual Behavior
The resources are created but after applying the plan terraform outputs:
provider "module.old_main.provider["registry.terraform.io/integrations/github"]" produced
│ an unexpected new value: Root object was present, but now absent.
Terraform Version
Terraform v1.14.3
on linux_amd64
...
- provider registry.terraform.io/integrations/github v6.9.1
Affected Resource(s)
- github_actions_environment_secret
- github_actions_environment_variable
Terraform Configuration Files
terraform {
required_providers {
github = {
source = "integrations/github"
version = "6.9.1"
}
}
}
provider "github" {}
resource "github_repository_environment" "environment" {
repository = "my-repo"
environment = "default"
}
resource "github_actions_environment_secret" "deployment_key" {
repository = "my-repo"
environment = github_repository_environment.environment.environment
secret_name = "DEPLOYMENT_PRIVATE_KEY"
plaintext_value = "my-super-secret-key"
}
Steps to Reproduce
run terraform apply to create the resources.
Debug Output
....
# module.old_main.github_actions_environment_secret.deployment_key will be created
+ resource "github_actions_environment_secret" "deployment_key" {
+ created_at = (known after apply)
+ environment = "default"
+ id = (known after apply)
+ plaintext_value = (sensitive value)
+ repository = "my-repo"
+ secret_name = "DEPLOYMENT_PRIVATE_KEY"
+ updated_at = (known after apply)
}
...
Panic Output
...
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to module.old_main.github_actions_environment_secret.deployment_key, provider "module.old_main.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.
╵Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type: BugSomething isn't working as documented
Activity
github-actions commentedon Jan 7, 2026
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with
Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀stevehipwell commentedon Jan 7, 2026
@Tidschimon please could you fill out the issue template so someone can look into this for you?
[-][BUG]: Provider produced inconsistent result after apply (v9.1.0)[/-][+][BUG]: Provider produced inconsistent result after apply (v6.9.1)[/+]Tidschimon commentedon Jan 9, 2026
@stevehipwell I edited the description. I also had to boil down the outputs since this is part of a larger project and I can't share specifics, so I hope the code snippet still makes some sense
stevehipwell commentedon Jan 9, 2026
@Tidschimon it looks like you're using modules? If so do you have the following block in your sub-module?
Tidschimon commentedon Jan 9, 2026
@stevehipwell
Yes to both, I do use modules and I do have that block in the sub-module. The snippet shared in the issue description not only specifies "integrations/github" (I remember earlier versions of this provider had a different name), but it also provides the current version "6.9.1". Or do you mean something different, here?
Also, I think I would need this block even if I only had one main module, wouldn't I?
I also think, that this issue is highly related to #2843 but in this case for environment variables and secrets.
stevehipwell commentedon Jan 9, 2026
@Tidschimon you should have the block with a version in the root module and then the block without a version in sub-modules.
I think you may be right.
Are you using github.com or GHEC or GHES?
Tidschimon commentedon Jan 9, 2026
@stevehipwell
The repository in question is hosted on github.com but behind a coporate organization, so it practically is a private repository. I know, for this I have to specify the organization as the owner of the repository.
So the provider block actually looks something like this
I also can confirm that the variables and secrets are in fact created. It is only terraform and the state that have a hiccup there
stevehipwell commentedon Jan 9, 2026
@Tidschimon so EMU then? Are you using data residency (non-standard URL)?
Tidschimon commentedon Jan 9, 2026
@stevehipwell I am not 100% sure of the mechanisms at play. From my perspective we are using organizations .
As far as the relevant part, the repository urls are concerned, these look pretty standard to me.
They follow the scheme: https://github.com/<organisation>/<repository> if that is what you were looking for.
so, coming back to the dummy data I so far referenced, this would be:
https://github.com/my-organisation/my-repo
deiga commentedon Jan 9, 2026
@Tidschimon just to double-check it's just an Organization on github.com and not an Organization inside an Enterprise on github.com?
Would you be able to run terraform apply with TF_LOG=DEBUG and post that (redacted of course)?
nickfloyd commentedon Jan 9, 2026
Could this be a race condition in the env secret logic. I remember feeling unsteady about this change because of conditions that could cause 404s.
GetEnvSecret and GetEnvVariable already perform this check for the given resource.
When Repositories.Get() 404s (while fetching the metadata for the repository) the precheck might be causing the race condition because it's not checking to see if the actual resource (env secret or env var) were dealing with exists.
Check me on this but it seems like...
I feel like we need to remove the status code check and id set part of this:
Tidschimon commentedon Jan 12, 2026
Sorry for the late reply. Over the weekend I set up a minimal example with one of my personal repositories which was working flawlessly. I could create the environment and a secret and the state was also tracked.
Since the Github resources are only a small part of all that is to be deployed, I just extracted them to a minimal example, so I also could redact the debug output a bit better.
I am applying this terraform script:
When applied this produces the following debug log.
debug.log
As side note: The environment and the secret are successfully created, only the feedback doesn't seem to make it back.
I hope this helps
EDIT:
The environment itself seems to make it into the state, though, so it is only the secret/variable that has problems
stevehipwell commentedon Jan 12, 2026
OK, I think there are two actual defects here. The first, less common issue (at least on github.com) is related to a lack of support for the scenario where the secret hasn't been fully replicated within the system when we look it up to get the dates. The second, and likely the issue in your reproduction, is due to there being no escaping for the resource ID which uses a
:to seperate the individual parts of the ID.@Tidschimon could you attempt to reproduce after swapping out the
:in your environment name?Tidschimon commentedon Jan 12, 2026
@stevehipwell that, my friend, is a bullseye!
Switching out the
:for e.g. an_yields no problems.The last question would then be, how to continue from here?
Is escaping the
:something you guys will tackle or something I just should not do?stevehipwell commentedon Jan 12, 2026
@Tidschimon I should be able to fix this as part of #3069 but I don't have a timeline for this.
Tidschimon commentedon Jan 13, 2026
At this point: Thanks a lot for the exchange, the troubleshooting and the support in getting this sorted out.
❤️