Skip to content

Passing lease id in Terraform remote backend #34924

Open
@Shashwat2712200

Description

@Shashwat2712200

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.7.3

AzureRM Provider Version

3.46.0

Affected Resource(s)/Data Source(s)

azurerm

Terraform Configuration Files

terraform {
  backend "azurerm" {
    storage_account_name = "abc"
    container_name       = "tfstate"
    key                  = "dev.terraform.tfstate"
    access_key = "12345"
  }
}
I have provided lease(lock) to my container and while running terraform apply it is saying state blob is already locked I want terraform to run in the leased(locked) state which is provided by azure but in terraform documentation there is no mention of how to pass the lease id if the state is locked while running terraform commands.

Debug Output/Panic Output

│ Error: Error acquiring the state lock
│ 
│ Error message: 2 errors occurred:
│ 	* state blob is already locked
│ 	* blob metadata "terraformlockid" was empty

Expected Behaviour

There is no such feature of passing lease id in terraform if state file is leased.

Actual Behaviour

│ * state blob is already locked

Steps to Reproduce

I have tried this command terraform apply -lock=false so that terraform doesn't lock itself and using azure lease feature of acquiring and breaking lease for locking but I get this error * state blob is already locked
Is there any way I can run terraform apply while my container is leased.

Important Factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions