UPD: replaced region shortname with just the region prefix

This commit is contained in:
xpk 2022-09-08 16:22:06 +08:00
parent 346acca7fd
commit a4bdee471e
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
2 changed files with 5 additions and 6 deletions

View File

@ -4,10 +4,9 @@ variable "project" {}
variable "application" {} variable "application" {}
variable "default-tags" {} variable "default-tags" {}
variable "aws-region" {} variable "aws-region" {}
variable "aws-region-short" {}
locals { locals {
resource-prefix = "${var.environment}-${var.aws-region-short}-${var.customer-name}-${var.project}" resource-prefix = "${var.environment}-${substr(var.aws-region,0,2)}-${var.customer-name}-${var.project}"
} }
# VPC variables # VPC variables

View File

@ -122,15 +122,15 @@ resource "aws_route" "private-routes" {
} }
resource "aws_route_table_association" "public_route_association" { resource "aws_route_table_association" "public_route_association" {
for_each = toset(aws_subnet.public-subnets.*.id) count = length(aws_subnet.public-subnets)
route_table_id = aws_route_table.public-route-table[0].id route_table_id = aws_route_table.public-route-table[0].id
subnet_id = each.value subnet_id = aws_subnet.public-subnets[count.index].id
} }
resource "aws_route_table_association" "private_route_association" { resource "aws_route_table_association" "private_route_association" {
for_each = toset(aws_subnet.private-subnets.*.id) count = length(aws_subnet.private-subnets)
route_table_id = aws_route_table.private-route-table[0].id route_table_id = aws_route_table.private-route-table[0].id
subnet_id = each.value subnet_id = aws_subnet.private-subnets[count.index].id
} }
/* /*