UPD: region short now replaced with just the first 2 letters of region name

This commit is contained in:
xpk 2022-09-05 11:44:39 +08:00
parent 007bfc1a95
commit 0bd23ee8ba
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
2 changed files with 4 additions and 6 deletions

View File

@ -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 {

View File

@ -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