sidpalas / devops-directive-terraform-course

Companion repo for complete Terraform course
1.04k stars 1.67k forks source link

06-organization-and-modules authentication error at the S3 buckets #9

Open carlos-salinas opened 2 years ago

carlos-salinas commented 2 years ago

terraform apply fails and seems there is a mismatch on the region settings according to the output:

Error: Error creating S3 bucket: AuthorizationHeaderMalformed: The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-west-1'
│       status code: 400, request id: 4RJBY0EQFNJY30Y7, host id: whXFjlyFiu++nd24wkW2gwnzC/lJ8+xrqT5Ihumb1r7dSAjqk4qYFut43pjdnrc3PJFi7ZaU8qs=
│ 
│   with module.web_app_2.aws_s3_bucket.bucket,
│   on ../web-app-module/storage.tf line 1, in resource "aws_s3_bucket" "bucket":
│    1: resource "aws_s3_bucket" "bucket" {

Any idea how to fix this?

sidpalas commented 2 years ago

Hmm, is the user who's credentials TF is using only authorized to create buckets in us-east-1?

Or perhaps the AWS provider is set to use one region while the bucket is set to provision in a different region?

Are you making any customizations to the config in the repo that might be relevant?

carlos-salinas commented 2 years ago

AFAIK I have rights to create buckets, because I was able in the previous exercises. Regarding config changes, I had to change the bucket name because it must unique globally, as you may know.