Skip to content

Instantly share code, notes, and snippets.

@gungoren
Created January 17, 2023 15:26
Show Gist options
  • Save gungoren/d1fe50a9a25b77851fbe9e5f2cdb0d6a to your computer and use it in GitHub Desktop.
Save gungoren/d1fe50a9a25b77851fbe9e5f2cdb0d6a to your computer and use it in GitHub Desktop.
resource "aws_s3_bucket_policy" "cdn-cf-policy" {
bucket = module.origin_bucket.s3_bucket_id
policy = data.aws_iam_policy_document.my-cdn-cf-policy.json
}
data "aws_iam_policy_document" "my-cdn-cf-policy" {
statement {
sid = "1"
principals {
type = "AWS"
identifiers = module.cdn.cloudfront_origin_access_identity_iam_arns
}
actions = [
"s3:GetObject"
]
resources = [
"${module.origin_bucket.s3_bucket_arn}/*"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment