diff --git a/infra/local.tf b/infra/local.tf index 34ce88c..4349106 100644 --- a/infra/local.tf +++ b/infra/local.tf @@ -3,9 +3,5 @@ locals { repos = [ "reverse-proxy", ] - buckets = [ - "shockrah.xyz", - "resume.shockrah.xyz" - ] } diff --git a/infra/s3.tf b/infra/s3.tf index 0426b21..fea86d8 100644 --- a/infra/s3.tf +++ b/infra/s3.tf @@ -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" +} +