Skip to content

Commit

Permalink
VPC setup fixes due to changed AWS defaults (#629)
Browse files Browse the repository at this point in the history
Signed-off-by: Stavros Foteinopoulos <[email protected]>
  • Loading branch information
stafot authored Sep 1, 2023
1 parent fa05f80 commit caa885f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions aws/vpc-setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ No modules.
| [aws_iam_user_policy_attachment.installation_users_attach_s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user_policy_attachment) | resource |
| [aws_s3_bucket.installation_buckets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_acl.installation_buckets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_acl) | resource |
| [aws_s3_bucket_ownership_controls.installation_buckets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_ownership_controls) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.installation_buckets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_s3_bucket_versioning.installation_buckets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_versioning) | resource |
| [aws_secretsmanager_secret.installation_users_keys](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret) | resource |
Expand Down
9 changes: 9 additions & 0 deletions aws/vpc-setup/installation_s3_buckets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ resource "aws_s3_bucket" "installation_buckets" {
}
}

resource "aws_s3_bucket_ownership_controls" "installation_buckets" {
for_each = toset(var.vpc_cidrs)
bucket = format("%s-%s", var.name, aws_vpc.vpc_creation[each.value]["id"])

rule {
object_ownership = "ObjectWriter"
}
}

resource "aws_s3_bucket_acl" "installation_buckets" {
for_each = toset(var.vpc_cidrs)
bucket = format("%s-%s", var.name, aws_vpc.vpc_creation[each.value]["id"])
Expand Down

0 comments on commit caa885f

Please sign in to comment.