Provides a resource to manage an S3 Control Bucket Policy.
resource "aws_s3control_bucket_policy" "example" {
bucket = aws_s3control_bucket.example.arn
policy = jsonencode({
Id = "testBucketPolicy"
Statement = [
{
Action = "s3-outposts:PutBucketLifecycleConfiguration"
Effect = "Deny"
Principal = {
AWS = "*"
}
Resource = aws_s3control_bucket.example.arn
Sid = "statement1"
}
]
Version = "2012-10-17"
})
}
The following arguments are required:
bucket
- (Required) Amazon Resource Name (ARN) of the bucket.policy
- (Required) JSON string of the resource policy. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.This resource exports the following attributes in addition to the arguments above:
id
- Amazon Resource Name (ARN) of the bucket.In Terraform v1.5.0 and later, use an import
block to import S3 Control Bucket Policies using the Amazon Resource Name (ARN). For example:
import {
to = aws_s3control_bucket_policy.example
id = "arn:aws:s3-outposts:us-east-1:123456789012:outpost/op-12345678/bucket/example"
}
Using terraform import
, import S3 Control Bucket Policies using the Amazon Resource Name (ARN). For example:
% terraform import aws_s3control_bucket_policy.example arn:aws:s3-outposts:us-east-1:123456789012:outpost/op-12345678/bucket/example