Making public files for websites buckets public readable

This commit is contained in:
shockrah 2023-08-09 21:51:21 -07:00
parent 4987559b15
commit d9e0e8c70b
2 changed files with 27 additions and 4 deletions

View File

@ -3,9 +3,5 @@ locals {
repos = [
"reverse-proxy",
]
buckets = [
"shockrah.xyz",
"resume.shockrah.xyz"
]
}

View File

@ -1,3 +1,10 @@
locals {
buckets = [
"shockrah.xyz",
"resume.shockrah.xyz"
]
}
resource "aws_s3_bucket" "static-content" {
for_each = {
for idx, record in local.buckets:
@ -11,3 +18,23 @@ resource "aws_s3_bucket" "static-content" {
Description = "Static content"
}
}
##################################################################
# Below are the acl components for each bucket to make them public
##################################################################
#resource "aws_s3_bucket_ownership_controls" "static-content" {
# for_each = toset(local.buckets)
# bucket = each.value
# rule {
# object_ownership = "BucketOwnerPreferred"
# }
#}
resource "aws_s3_bucket_acl" "static-content" {
for_each = toset(local.buckets)
bucket = each.value
acl = "public-read"
}