brikis98 / terraform-up-and-running-code

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

Chapter 3 #115

Closed Obasoro closed 9 months ago

Obasoro commented 9 months ago

running the code below I get this error, tried to debug my way but still coming up

terraform init -backend-config=backend.hcl

Initializing the backend...
╷
│ Error: Failed to get existing workspaces: S3 bucket does not exist.
│ 
│ The referenced S3 bucket must have been previously created. If the S3 bucket
│ was created within the last minute, please wait for a minute or two and try
│ again.
│ 
│ Error: NoSuchBucket: The specified bucket does not exist
│       status code: 404, request id: 97Y3S9DC6WEF2T8X, host id: scJpjeLE59XtJYtU5rPDKFyPBOn+5xUz4DFO+H4xwjlz2/mkLTSnj6pmmcQE8F+1U2DKh4b5TV4=
brikis98 commented 9 months ago

What is in backend.hcl? And do you have a backend block in your Terraform code? If so, what does that contain?

Obasoro commented 9 months ago

Thanks @brikis98. I created an s3 bucket and ran the terraform init -backend-config=backend.hcl. It worked fine.

My backend.hcl contains the following

bucket = "kunle-storage-tur"
region = "us-east-1"
dynamodb_table = "kunle-tur"
encrypt        = true
brikis98 commented 9 months ago

Ah, OK, yes, as the error indicates, the S3 bucket must exist :)

Sounds like you got this working, so I'll close this issue.