Skip to content

Commit

Permalink
Adding the NAT gateway back just incase people want to use a public e…
Browse files Browse the repository at this point in the history
…ndpoint for exporters. Didn't think about that when I removed it. Whoops. (#5)
  • Loading branch information
thathaneydude authored Jun 6, 2024
1 parent 57c055b commit 388d77e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
27 changes: 27 additions & 0 deletions nat_gateway.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
resource "azurerm_public_ip" "nat_gw_ip" {
name = var.nat_gateway_ip_name
location = var.location
resource_group_name = var.resource_group_name
allocation_method = "Static"
sku = "Standard"

tags = var.tags
}

resource "azurerm_nat_gateway" "lb_nat_gw" {
name = var.nat_gateway_name
location = var.location
resource_group_name = var.resource_group_name

tags = var.tags
}

resource "azurerm_subnet_nat_gateway_association" "nat_gw_association" {
subnet_id = azurerm_subnet.subnet.id
nat_gateway_id = azurerm_nat_gateway.lb_nat_gw.id
}

resource "azurerm_nat_gateway_public_ip_association" "public_ip_association" {
nat_gateway_id = azurerm_nat_gateway.lb_nat_gw.id
public_ip_address_id = azurerm_public_ip.nat_gw_ip.id
}
8 changes: 8 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ output "internal_load_balancer_name" {
value = azurerm_lb.scale_set_lb.name
}

output "nat_gateway_public_ip_name" {
value = azurerm_public_ip.nat_gw_ip.name
}

output "nat_gateway_name" {
value = azurerm_nat_gateway.lb_nat_gw.name
}

output "sensor_identity_principal_id" {
value = azurerm_linux_virtual_machine_scale_set.sensor_scale_set.identity[0].principal_id
}
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ variable "sensor_admin_username" {
default = "corelight"
}

variable "nat_gateway_ip_name" {
description = "The resource name of the VMSS NAT Gateway public IP resource"
type = string
default = "cl-nat-gw-ip"
}

variable "nat_gateway_name" {
description = "The resource name of the VMSS NAT Gateway resource"
type = string
default = "cl-sensor-nat-gw"
}

variable "autoscale_setting_name" {
description = "The VMSS autoscale monitor name"
type = string
Expand Down

0 comments on commit 388d77e

Please sign in to comment.