Terraform 远程状态后端错误-缺少 Blob Lease Id

Terraform 远程状态后端错误-缺少 Blob Lease Id

我正在尝试更新 Azure 中的远程状态文件。创建 blob 后,当我运行 terraform apply 时,出现以下错误:

这是错误:

* 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.
RequestId:7befe65c-601e-00ba-60e0-cb868c000000
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=

但是,我没有该 blob 上的任何租约,但在 terraform 中运行时,文件仍显示该容器已被租用,但租用 ID 丢失。

我甚至尝试过使用强制解锁,但没有用。

如果有人知道如何实现这一点,请帮助我。谢谢

答案1

问题不在于租约。问题在于我通过代码本身在 blob 中创建容器。但是,blobs 会自动创建它,我们只需传递容器的名称即可。

相关内容