Skip to content

Commit

Permalink
Get current region from data source (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Sep 25, 2024
1 parent c681f8e commit 00eb2eb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions infrastructure/region/aws.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data "aws_region" "current" {}
2 changes: 1 addition & 1 deletion infrastructure/region/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ resource "aws_ecs_cluster" "svcs" {
name = "HomeAssistant-Services"

tags = {
Region = var.region
Region = data.aws_region.current.name
}
}
12 changes: 6 additions & 6 deletions infrastructure/region/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ resource "aws_vpc" "network" {
enable_dns_hostnames = true

tags = {
Region = var.region
Region = data.aws_region.current.name
}
}

resource "aws_internet_gateway" "gw_internet" {
vpc_id = aws_vpc.network.id

tags = {
Region = var.region
Region = data.aws_region.current.name
}
}

Expand All @@ -24,7 +24,7 @@ resource "aws_route_table" "public" {
}

tags = {
Region = var.region
Region = data.aws_region.current.name
Zone = "public"
}
}
Expand All @@ -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]
Expand All @@ -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
}
}

Expand All @@ -63,7 +63,7 @@ resource "aws_route_table" "private" {
}

tags = {
Region = var.region
Region = data.aws_region.current.name
Zone = "private"
}
}
4 changes: 2 additions & 2 deletions infrastructure/region/subnet.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand All @@ -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"
}
}
Expand Down

0 comments on commit 00eb2eb

Please sign in to comment.