brikis98 / terraform-up-and-running-code

Code samples for the book "Terraform: Up & Running" by Yevgeniy Brikman
http://www.terraformupandrunning.com/
MIT License
2.94k stars 1.94k forks source link

failed to lock s3 state: 2 errors occurred: #108

Open Mazuco opened 1 year ago

Mazuco commented 1 year ago

Hello, in the "State File Isolation" section, when following the commands and codes, when it comes time to create a new workspace:

terraform workspace new example1

It issues this error:

terraform workspace new test1

failed to lock s3 state: 2 errors occurred:

I've tried different ways to fix this, I've used your main.tf code, but it doesn't work. How can we resolve this?

thanhtrungit25 commented 5 months ago

I know this issue, because the name resource you typed in code, and when you copy in book. They not matched

brikis98 commented 2 weeks ago

It sounds like you have a backend configuration in your code pointing to an S3 bucket and/or DynamoDB table that does not yet exist. Did you create the bucket and table before running init / terraform workspace new?