diff --git a/services/terraform/modules/shared/s3.tf b/services/terraform/modules/shared/s3.tf --- a/services/terraform/modules/shared/s3.tf +++ b/services/terraform/modules/shared/s3.tf @@ -7,5 +7,5 @@ resource "aws_s3_bucket" "comm_buckets" { count = length(var.s3_bucket_names) - bucket = var.s3_bucket_names[count.index] + bucket = "${var.s3_bucket_names[count.index]}${var.bucket_name_suffix}" } diff --git a/services/terraform/modules/shared/variables.tf b/services/terraform/modules/shared/variables.tf --- a/services/terraform/modules/shared/variables.tf +++ b/services/terraform/modules/shared/variables.tf @@ -2,3 +2,9 @@ type = bool default = false } + +variable "bucket_name_suffix" { + type = string + default = "" + description = "Suffix added to all bucket names" +} diff --git a/services/terraform/remote/main.tf b/services/terraform/remote/main.tf --- a/services/terraform/remote/main.tf +++ b/services/terraform/remote/main.tf @@ -43,6 +43,7 @@ # Shared resources between local dev environment and remote AWS module "shared" { - source = "../modules/shared" + source = "../modules/shared" + bucket_name_suffix = local.is_staging ? "-staging" : "" }