I am trying to update the remote state file in Azure. Once the blob is created, then when I run terraform apply - I get the following error:

This is the error:

* azurerm_storage_blob.testsb: Error setting properties of blob dev.terraform.tfstate (container tfstate, storage account acctestaccs): 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.
Time:2019-02-24T01:33:46.3387895Z, RequestInitiated=Sun, 24 Feb 2019 01:33:45 GMT, RequestId=7befe65c-601e-00ba-60e0-cb868c000000, API Version=2016-05-31, QueryParameterName=, QueryParameterValue=

However, I don't have any lease on that blob but still while running in terraform the file shows that the container has been leased and please the lease ID is missing.

I have even tried to use force-unlock but it doesn't work.

Please help me if anyone has a clue on how can this be made working. Thanks


The issue was not with the lease. The issue was that I was creating the container in the blob through the code itself. However, blobs automatically create it, we just have to pass the name of the container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.