Skip to content
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

Unable to force-unlock state #640

Closed
CoRfr opened this issue Dec 19, 2017 · 6 comments
Closed

Unable to force-unlock state #640

CoRfr opened this issue Dec 19, 2017 · 6 comments
Labels
upstream/terraform This issue is blocked on an upstream issue within Terraform (Terraform Core/CLI, The Plugin SDK etc)

Comments

@CoRfr
Copy link
Contributor

CoRfr commented Dec 19, 2017

The error looks like that:

terraform force-unlock -force <id>
Failed to unlock state: failed to delete lock info from metadata: storage: service returned error: StatusCode=412, ErrorCode=LeaseIdMissing, ErrorMessage=There is currently a lease on the blob and no lease ID was specified in the request.
RequestId:6c8ebe08-001e-00d8-71c9-789fb8000000
Time:2017-12-19T12:58:50.4189788Z, RequestInitiated=Tue, 19 Dec 2017 12:58:49 GMT, RequestId=6c8ebe08-001e-00d8-71c9-789fb8000000, API Version=2016-05-31, QueryParameterName=, QueryParameterValue=
Lock Info:
  ID:        <id>
  Path:      terraform-state/dev.terraform.tfstate
  Operation: OperationTypeApply
  Who:       @jenkins
  Version:   0.11.1
  Created:   2017-12-19 12:53:08.462280312 +0000 UTC
  Info:

Terraform Version

0.11.1

Affected Resource(s)

Terraform State ?

Expected Behavior

terraform should unlock the state, and it should be possible to run terraform apply again after.

Actual Behavior

terraform raises an exception and the lock is still present.

Steps to Reproduce

  1. terraform apply
  2. Ctrl+C
  3. terraform apply (prints an error with the unlock id)
  4. `terraform force-unlock -force

References

Looks like this user had the same issue: https://groups.google.com/forum/#!topic/terraform-tool/we21XjC58pI

@tombuildsstuff tombuildsstuff added the upstream/terraform This issue is blocked on an upstream issue within Terraform (Terraform Core/CLI, The Plugin SDK etc) label Jan 3, 2018
@tombuildsstuff
Copy link
Contributor

Hey @CoRfr

Thanks for opening this issue (apologies for the delayed response to this over the Christmas break)

Since this issue is related to the Azure Backend / Terraform Core and not the AzureRM Provider - would you be able to re-open this issue on the Terraform Core Repository? Whilst I can do this for you - if you migrate this over you'll be subscribed to updates for the new issue which will indicate when this is resolved.

Thanks!

@CoRfr
Copy link
Contributor Author

CoRfr commented Jan 5, 2018

Hey @tombuildsstuff ,

I'm not sure how this would be part from the Core and not the AzureRM provider, as it seems to me that an operation (breakage of the lease) is not performed by the ARM provider when we do the --force-unlock.
Could you detail why you think the problem is coming from the Core, so that I can eventually create the issue on the Core repository if appropriate.

Thanks

@tombuildsstuff
Copy link
Contributor

hey @CoRfr

Sure - so the Azure Backend and the Azure Provider whilst accessing the same API and using the same SDK) are housed in different repositories, with the Azure Provider being in this repository and Azure Backend being housed within the Terraform (Core) repository.

The force-unlock command is part of Terraform Core which calls into the Azure Backend to release the lock. As such, this issue is with the Azure Backend and not the Azure Provider - we need to migrate this issue over to the main (Core) repository.

Hope that helps :)

Thanks!

@CoRfr
Copy link
Contributor Author

CoRfr commented Jan 5, 2018

Thanks for the explanation @tombuildsstuff , I just opened hashicorp/terraform#17046

@tombuildsstuff
Copy link
Contributor

@CoRfr awesome, thanks. I've tagged the other issue appropriately and we'll take a look over there - in the interim I'm going to close this issue in favour of that one.

Thanks!

@ghost
Copy link

ghost commented Mar 30, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
upstream/terraform This issue is blocked on an upstream issue within Terraform (Terraform Core/CLI, The Plugin SDK etc)
Projects
None yet
Development

No branches or pull requests

3 participants