Skip to content

Commit

Permalink
add bucket policy
Browse files Browse the repository at this point in the history
  • Loading branch information
ashle001 committed Sep 24, 2020
1 parent b84d639 commit de678d7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ data "aws_iam_policy_document" "this" {
}
}

#---
# apply policy to bucket and public access block policy to bucket
#---
resource "aws_s3_bucket_policy" "policy" {
bucket = aws_s3_bucket.this.bucket
policy = data.aws_iam_policy_document.this.json
depends_on = [null_resource.policy_delay]
}

resource "aws_s3_bucket_public_access_block" "this" {
bucket = aws_s3_bucket.this.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}

resource "null_resource" "s3_create_wait" {
triggers = {
bucket = aws_s3_bucket.this.id
Expand Down

0 comments on commit de678d7

Please sign in to comment.