diff --git a/infrastructure/region/aws.tf b/infrastructure/region/aws.tf new file mode 100644 index 0000000..b4c27da --- /dev/null +++ b/infrastructure/region/aws.tf @@ -0,0 +1 @@ +data "aws_region" "current" {} \ No newline at end of file diff --git a/infrastructure/region/ecs.tf b/infrastructure/region/ecs.tf index d0b68c0..6909a5e 100644 --- a/infrastructure/region/ecs.tf +++ b/infrastructure/region/ecs.tf @@ -2,6 +2,6 @@ resource "aws_ecs_cluster" "svcs" { name = "HomeAssistant-Services" tags = { - Region = var.region + Region = data.aws_region.current.name } } diff --git a/infrastructure/region/network.tf b/infrastructure/region/network.tf index 1969165..0508b39 100644 --- a/infrastructure/region/network.tf +++ b/infrastructure/region/network.tf @@ -3,7 +3,7 @@ resource "aws_vpc" "network" { enable_dns_hostnames = true tags = { - Region = var.region + Region = data.aws_region.current.name } } @@ -11,7 +11,7 @@ resource "aws_internet_gateway" "gw_internet" { vpc_id = aws_vpc.network.id tags = { - Region = var.region + Region = data.aws_region.current.name } } @@ -24,7 +24,7 @@ resource "aws_route_table" "public" { } tags = { - Region = var.region + Region = data.aws_region.current.name Zone = "public" } } @@ -35,7 +35,7 @@ resource "aws_eip" "nat" { vpc = true tags = { - Region = var.region + Region = data.aws_region.current.name } depends_on = [aws_internet_gateway.gw_internet] @@ -48,7 +48,7 @@ resource "aws_nat_gateway" "gw_nat" { subnet_id = aws_subnet.public[count.index].id tags = { - Region = var.region + Region = data.aws_region.current.name } } @@ -63,7 +63,7 @@ resource "aws_route_table" "private" { } tags = { - Region = var.region + Region = data.aws_region.current.name Zone = "private" } } diff --git a/infrastructure/region/subnet.tf b/infrastructure/region/subnet.tf index 5e40560..cc962d2 100644 --- a/infrastructure/region/subnet.tf +++ b/infrastructure/region/subnet.tf @@ -10,7 +10,7 @@ resource "aws_subnet" "public" { availability_zone = data.aws_availability_zones.available.names[count.index] tags = { - Region = var.region + Region = data.aws_region.current.name Zone = "public" } } @@ -23,7 +23,7 @@ resource "aws_subnet" "private" { availability_zone = data.aws_availability_zones.available.names[count.index] tags = { - Region = var.region + Region = data.aws_region.current.name Zone = "private" } }