The bucket policy data source returns IAM policy of an S3 bucket.
The following example retrieves IAM policy of a specified S3 bucket.
data "aws_s3_bucket_policy" "example" {
bucket = "example-bucket-name"
}
output "foo" {
value = data.aws_s3_bucket_policy.example.policy
}
This data source supports the following arguments:
bucket
- (Required) Bucket name.This data source exports the following attributes in addition to the arguments above:
policy
- IAM bucket policy.