Issue with state locking AWS dynamodb

Hey all.

I’m trying to follow Yevgeniy’s book "up and running"
I’m hitting the following error, and I’m not sure what it means.

[terragrunt] 2017/11/13 14:57:13 At 4:3: root.terragrunt.lock: map must have string keys
[terragrunt] 2017/11/13 14:57:13 Unable to determine underlying exit code, so Terragrunt will exit with error code 1```

My terraform.tfvars file contains this

terragrunt = {
lock = {
backend = “dynamodb”

config {
state_file_id = "global/s3"
}

}
remote_state = {
backend = “s3”

config {
encrypt = "true"
bucket = "know_devops_tf_state_bucket"
key = "global/s3/terraform.tfstate"
region = "us-east-1"
}

}
}

Can anyone please advise what I’m missing.
I’m not seeing a clear example in the docs that explains exactly how to set up locking.
Many thanks

What version of Terragrunt are you using?

I’m using terragrunt version v0.13.19

OK, gotcha. I’m guessing you are following examples from the book, which came out when Terragrunt was still on v0.11.x or so. Quite a bit has changed since then! We described the changes in the Upgrading to Terragrunt 0.12.x migration guide.

That said, if you are just getting started, there’s no reason to do a “migration.” Instead, start from scratch by reading through the docs. In particular, you no longer need to specify the lock settings at all (Terraform now has locking built-in) and your remote state config should look like this (the lock config should be set to true with no quotes).

Hey, I’m using
terragrunt version v0.13.19

Thank you

Yes, I’m following the book example, and it gave me a warning that
.terragrunt was being depreciated. I headed over to the repo and that’s
what’s confused me I think. Because this is new to me, I’m not so sure of
what needs to go where.

Thanks for the links. I’ll see how far I get and get back to you.

Great, thank you, that’s working now.
I was completely confused before. :smiley:

Ian

I’m happy to hear that worked!

FYI, I’ve also updated my atom config with the following so it reads tfvars
files and highlights them accordingly.

customFileTypes:
‘source.hcl’: [
‘tfvars’
]

1 Like