Skip to content

Commit

Permalink
Rename enable_nat to nat_enabled (#336)
Browse files Browse the repository at this point in the history
* Update private_subnet.tf

* Update variables.tf
  • Loading branch information
thaunghtike-share authored Sep 18, 2023
1 parent 4588793 commit d159c9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions private_subnet.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ resource "aws_subnet" "private" {
}

resource "aws_eip" "eips" {
count = var.enable_nat && length(var.eips) == 0 ? 2 : 0
count = var.nat_enabled && length(var.eips) == 0 ? 2 : 0
tags = local.tags
}

resource "aws_nat_gateway" "gw" {
count = var.enable_nat ? 2 : 0
count = var.nat_enabled ? 2 : 0

allocation_id = length(var.eips) == 0 ? aws_eip.eips[count.index].id : var.eips[count.index].id
subnet_id = aws_subnet.public[count.index].id
Expand All @@ -41,7 +41,7 @@ resource "aws_route_table" "private" {
}

resource "aws_route" "nat" {
count = var.enable_nat ? 2 : 0
count = var.nat_enabled ? 2 : 0

route_table_id = aws_route_table.private[count.index].id
destination_cidr_block = "0.0.0.0/0"
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ variable "enable_ipv6" {
description = "Enable an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC"
}

variable "enable_nat" {
variable "nat_enabled" {
default = true
description = "Whether the NAT gateway is enabled"
}
Expand Down

0 comments on commit d159c9f

Please sign in to comment.