Remove lock from Azure blob storage

1,232 views
Skip to first unread message

Andrew Hodgson

unread,
Nov 20, 2017, 2:28:21 PM11/20/17
to terrafo...@googlegroups.com

Hi,

 

Has anyone had luck in deleting a Terraform lock from an Azure storage account?  State file is stored there.

 

terraform force-unlock 351e71b2-7984-9594-f8e0-1ba789488aa2

Do you really want to force-unlock?

  Terraform will remove the lock on the remote state.

  This will allow local Terraform commands to modify this state, even though it

  may be still be in use. Only 'yes' will be accepted to confirm.

 

  Enter a value: yes

 

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:1d9accf8-001e-0016-5a23-629b97000000

Time:2017-11-20T17:16:52.3182967Z, RequestInitiated=Mon, 20 Nov 2017 17:16:51 GMT, RequestId=1d9accf8-001e-0016-5a23-629b97000000, API Version=2016-05-31, QueryParameterName=, QueryParameterValue= Lock Info:

  ID:        351e71b2-7984-9594-f8e0-1ba789488aa2

  Path:      terraform/PROJECT-prod.tfstate

  Operation: OperationTypeApply

  Who:       DOMAIN\Andrew.Hodgson@HOSTNAME

  Version:   0.11.0

  Created:   2017-11-20 15:35:30.8470821 +0000 UTC

  Info:

 

Thanks.

Andrew.

 

Ufuk Altin

unread,
Jun 26, 2019, 9:00:40 AM6/26/19
to Terraform
Hi did you solve this? I have same issue

Ufuk Altin

unread,
Jun 27, 2019, 2:12:46 AM6/27/19
to Terraform
I did a workaround

1. backup the tfstate file in blob container (remember file name)
2. delete blob container (remember container name)
3. wait a while (because azure is deleting the container and a new one with same name can not be created)
4. create container with same name
5. upload tfstate file into blob container
Reply all
Reply to author
Forward
0 new messages