Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce S3 bucket length limits in main.tf by truncating TF workspace name #45

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ variable "commit_sha" {
resource "aws_s3_bucket" "glue_assets" {
# Prod buckets are managed outside this config
count = terraform.workspace == "prod" ? 0 : 1
bucket = "ccao-ci-${terraform.workspace}-glue-assets-us-east-1"
# Buckets can only be a max of 63 characters long:
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
bucket = "ccao-ci-${substr(terraform.workspace, 0, 33)}-glue-assets-us-east-1"
force_destroy = true
}

Expand All @@ -89,7 +91,7 @@ resource "aws_s3_bucket_versioning" "glue_assets" {

resource "aws_s3_bucket" "data_warehouse" {
count = terraform.workspace == "prod" ? 0 : 1
bucket = "ccao-ci-${terraform.workspace}-data-warehouse-us-east-1"
bucket = "ccao-ci-${substr(terraform.workspace, 0, 30)}-data-warehouse-us-east-1"
force_destroy = true
}

Expand Down