Skip to content

Commit

Permalink
[CES-6] Moved NAT Gateway in TF state (#1100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 authored Jul 30, 2024
1 parent 30f66a8 commit ee32085
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 519 deletions.
8 changes: 5 additions & 3 deletions src/core/_modules/networking/nat_gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ resource "azurerm_public_ip" "this_01" {
}

resource "azurerm_nat_gateway" "this" {
name = try(local.nonstandard[var.location_short].ng, "${var.project}-ng-01")
count = var.ng_number

name = try(local.nonstandard[var.location_short].ng, "${var.project}-ng-0${count.index + 1}")
location = var.location
resource_group_name = var.resource_group_name
sku_name = "Standard"
idle_timeout_in_minutes = 4
zones = [1]
zones = ["${count.index + 1}"]

tags = var.tags
}

resource "azurerm_nat_gateway_public_ip_association" "this_pip_01" {
count = var.ng_ips_number
nat_gateway_id = azurerm_nat_gateway.this.id
nat_gateway_id = azurerm_nat_gateway.this[0].id
public_ip_address_id = azurerm_public_ip.this_01[count.index].id
}
8 changes: 7 additions & 1 deletion src/core/_modules/networking/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ variable "ng_ips_number" {
type = number
description = "Number of public IPs assigned to the nat gateway"
default = 1
}
}

variable "ng_number" {
type = number
description = "Number of nat gateways to deploy"
default = 1
}
Loading

0 comments on commit ee32085

Please sign in to comment.