Resource: aws_s3_bucket_public_access_block

Manages S3 bucket-level Public Access Block configuration. For more information about these settings, see the AWS S3 Block Public Access documentation.

Example Usage

resource "aws_s3_bucket" "example" {
  bucket = "example"
}

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

  block_public_acls       = true
  block_public_policy     = true
  ignore_public_acls      = true
  restrict_public_buckets = true
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import aws_s3_bucket_public_access_block using the bucket name. For example:

import {
  to = aws_s3_bucket_public_access_block.example
  id = "my-bucket"
}

Using terraform import, import aws_s3_bucket_public_access_block using the bucket name. For example:

% terraform import aws_s3_bucket_public_access_block.example my-bucket