Created
February 5, 2022 18:00
-
-
Save davidvpe/f29424c30b3d0c7a9317b758bcfcb84d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_iam_policy_document" "s3_policy" { | |
statement { | |
actions = ["s3:GetObject"] | |
resources = ["${aws_s3_bucket.website.arn}/*"] | |
principals { | |
type = "AWS" | |
identifiers = [aws_cloudfront_origin_access_identity.oai.iam_arn] | |
} | |
} | |
} | |
resource "aws_s3_bucket_policy" "s3_policy" { | |
bucket = aws_s3_bucket.website.id | |
policy = data.aws_iam_policy_document.s3_policy.json | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment