Created Public S3 Bucket with Terraform – Lab Checker Says Bucket Doesn’t Exist (Terraform level 1)

I’m working on the Create Public S3 Bucket Using Terraform lab. (Terraform level 1)

My Terraform code creates a bucket named datacenter-s3-20078 with acl = "public-read".

aws --endpoint-url=http://aws:4566 s3 ls shows the bucket exists, and get-bucket-acl confirms public READ access.

However, when I submit the task, I get:
'datacenter-s3-20078' public s3 bucket doesn't exist.

It seems the checker is looking in real AWS while the lab uses LocalStack (provider.tf has an endpoints block pointing to http://aws:4566).

Has anyone else faced this? How can i solve this?

Hi @imranops

It would help if you could share your main.tf.

@imranops Please you can check if this helps create public s3 bucket terraform level 1

1 Like

@bansikah thanks a lot brother. I got the actual solution now. your help is much appreciated.

Here is my main.tf file

resource "aws_s3_bucket" "public_bucket" {
  bucket = "datacenter-s3-20078"
  acl    = "public-read"           

  tags = {
    Name = "datacenter-s3-20078"
  }
}

@imranops anytime brother am glad it could help

1 Like