-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error loading state: writing #16741
Comments
Same here, terraform 0.11.0 on an existing project. |
It is reproduceable as far as I see. In terraform 0.11 that introduced gcs with lock you can reproduce the issue using the following setup. Adding terraform_remote_state is causing a double lock that always fails. provider "google" {
credentials = "service-account.json"
project = "my-project"
region = "europe-west1"
}
terraform {
backend "gcs" {
credentials = "service-account.json"
project = "my-project"
bucket = "my-bucket"
path = "test.tfstate"
}
}
data "terraform_remote_state" "k8s" {
backend = "gcs"
config {
credentials = "service-account.json"
project = "my-project"
bucket = "my-bucket"
path = "test.tfstate"
}
} Note: Based on what I see, I am not sure even if there is any good solution for this scenario. Double lock will happen if we use remote-backend and at the same time try to load it through |
@kavehmzta there is no |
@octo sorry my bad. a typo while I was editing. |
…m_remote_state and gcs remote state at the same time. Fixes hashicorp#16741
@octo @tombuildsstuff can you please take a look at #16852 and see if it can be considered a fix or if I have missed something? |
Just FYI we've hit this as well, and until the fix is released a workaround is to pass the |
I just upgraded our build server to terraform 0.11.2 and removed the |
Apologies for awakening an old thread: I just hit this on 0.11.11, google provider 1.20.0 by (I think) accidentally adding a second provider without an alias. Removed the state lock file via Cheers! |
@smaslennikov How did you add an alias to the second provider? I believe I am hitting the same problem on 0.11.11 |
@curtbushko Here's what that section of my code looks like now:
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hi There,
We are getting below errors while we run the terraform apply/plan. Even we tried to force-unlock but did not help (terraform force-unlock 55c1e2b0-fe57-118a-81ee-d7442c0d353d) . Does anyone had any idea how to fix?
Error loading state: writing "gs://secret-meridian-680-tfstate/terraform.tflock" failed: googleapi: Error 412: Precondition Failed, conditionNotMet
Lock Info:
ID: 55c1e2b0-fe57-118a-81ee-d7442c0d353d
Path:
Operation: init
Who: mchauhan@Mchauhan-Latitude-E7450
Version: 0.11.0
Created: 2017-11-22 12:13:24.559036694 +0000 UTC
Info:
Thanks
Manoj
Terraform Version
Terraform Configuration Files
...
Debug Output
Crash Output
Expected Behavior
Actual Behavior
Steps to Reproduce
Important Factoids
References
The text was updated successfully, but these errors were encountered: