Making public files for websites buckets public readable
This commit is contained in:
parent
4987559b15
commit
d9e0e8c70b
@ -3,9 +3,5 @@ locals {
|
|||||||
repos = [
|
repos = [
|
||||||
"reverse-proxy",
|
"reverse-proxy",
|
||||||
]
|
]
|
||||||
buckets = [
|
|
||||||
"shockrah.xyz",
|
|
||||||
"resume.shockrah.xyz"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
27
infra/s3.tf
27
infra/s3.tf
@ -1,3 +1,10 @@
|
|||||||
|
locals {
|
||||||
|
buckets = [
|
||||||
|
"shockrah.xyz",
|
||||||
|
"resume.shockrah.xyz"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
resource "aws_s3_bucket" "static-content" {
|
resource "aws_s3_bucket" "static-content" {
|
||||||
for_each = {
|
for_each = {
|
||||||
for idx, record in local.buckets:
|
for idx, record in local.buckets:
|
||||||
@ -11,3 +18,23 @@ resource "aws_s3_bucket" "static-content" {
|
|||||||
Description = "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"
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user