Configures an S3 bucket with public-read ACL, making the bucket objects accessible to the public. This setup disables default security settings.

Terraform Template

resource "aws_s3_bucket" "example" {
  bucket = "my-tf-example-bucket"
}

resource "aws_s3_bucket_acl" "example" {
  acl = "public-read"
  bucket = aws_s3_bucket.example.id
  depends_on = ["aws_s3_bucket_ownership_controls.example", "aws_s3_bucket_public_access_block.example"]
}

resource "aws_s3_bucket_ownership_controls" "example" {
  bucket = aws_s3_bucket.example.id

  rule {
    object_ownership = "BucketOwnerPreferred"
  }
}

resource "aws_s3_bucket_public_access_block" "example" {
  block_public_acls = false
  block_public_policy = false
  bucket = aws_s3_bucket.example.id
  ignore_public_acls = false
  restrict_public_buckets = false
}