diff --git a/modules/storage/infra-s3-bucket/variables.tf b/modules/storage/infra-s3-bucket/variables.tf index 5590848..93920c2 100644 --- a/modules/storage/infra-s3-bucket/variables.tf +++ b/modules/storage/infra-s3-bucket/variables.tf @@ -19,8 +19,10 @@ variable "add-random-suffix" { default = false } +data aws_region this-region {} + locals { - resource-prefix = "${var.environment}-${var.aws-region-short}-${var.customer-name}-${var.project}" + resource-prefix = "${var.environment}-substr(${data.aws_region.this-region.name}, 0, 2)-${var.customer-name}-${var.project}" } variable bucket-acl { diff --git a/modules/terraform-setup/examples/main.tf b/modules/terraform-setup/examples/main.tf index 3fd5f6d..940d79b 100644 --- a/modules/terraform-setup/examples/main.tf +++ b/modules/terraform-setup/examples/main.tf @@ -32,14 +32,10 @@ terraform { # main.tf locals { - aws-region-short = lookup(module.aws-region-short.region-map, var.aws-region) + aws-region-short = substr(var.aws-region, 0, 2) resource-prefix = "${var.environment}-${local.aws-region-short}-${var.customer-name}-${var.project}" } -module "aws-region-short" { - source = "git::https://xpk.headdesk.me/git/xpk/terraform.aws-baseline-infra//modules/util/aws-region-short" -} - module "terraform-state-store" { source = "git::https://xpk.headdesk.me/git/xpk/terraform.aws-baseline-infra//modules/terraform-setup" enable-bucket-versioning = true