Terraform tfstate file getting repeated locked even after Break Lease. Tfstate file stored in Azure Storage Account Container.
How do I resolve the repeated tfstate file lock issue, The tfstate file is stored in Azure SA container.
Message in Terraform Init - "Terraform has created a lock file terraform.lock.hcl to record the provider selections it made above. Include this file in your version control repository so that Terraform can guarantee to make the same selections by default when you run "terraform init" in the future."
terraform.lock.hcl is added in gitignore.
If your Terraform
tfstatefile consistently gets locked, even after attempts to break the lease within an Azure Storage Account Container, it may indicate a more complex underlying problem. Here are some steps to consider.My Terraform for backend configuration
tfstatefile directly in the Azure Blob Storage to confirm if it is indeed locked or if the lock has been properly released. You can use the following command to check the blob's lease status:Follow confirm with the command below.
Ensure with Proper Terraform Workflow
Reference: