skip to Main Content

Is there a way to find the lock ID associated with a Terraform state configuration by using terraform command.

I can get lock ID when I call "terrafrom plan" for project with locked state but "terraform plan" takes bit time.

Command "terraform state list" does not show lock id next to locked resources, it only shows list of resources in state.

2

Answers


  1. The lock ID is present in a file called .terraform.tfstate.lock.info:

    $ jq -r '.ID' .terraform.tfstate.lock.info
    abf0e2d4......
    
    Login or Signup to reply.
  2. I’m pretty sure that the best way to achieve it is to look into your state table (in Dynamo DB / S3) and see the relevant Lock ID’s and filter them by your TF modules.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search