Skip to content

Commit

Permalink
fixing issue where the scale set fails to deploy on the first attempt…
Browse files Browse the repository at this point in the history
… due to the load balancer health probes not being available before the scale set is created.

Also removed the nat gateway as it shouldn't be necessary
  • Loading branch information
thathaneydude committed Jun 6, 2024
1 parent 44f48de commit 08bd973
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 47 deletions.
3 changes: 3 additions & 0 deletions load_balancer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ resource "azurerm_lb_rule" "monitoring_vxlan_lb_rule" {
backend_address_pool_ids = [
azurerm_lb_backend_address_pool.monitoring_pool.id
]
probe_id = azurerm_lb_probe.sensor_health_check_probe.id
}

resource "azurerm_lb_rule" "monitoring_geneve_lb_rule" {
Expand All @@ -54,6 +55,7 @@ resource "azurerm_lb_rule" "monitoring_geneve_lb_rule" {
backend_address_pool_ids = [
azurerm_lb_backend_address_pool.monitoring_pool.id
]
probe_id = azurerm_lb_probe.sensor_health_check_probe.id
}

resource "azurerm_lb_rule" "monitoring_health_check_rule" {
Expand All @@ -79,4 +81,5 @@ resource "azurerm_lb_rule" "management_lb_rule" {
backend_address_pool_ids = [
azurerm_lb_backend_address_pool.management_pool.id
]
probe_id = azurerm_lb_probe.sensor_health_check_probe.id
}
27 changes: 0 additions & 27 deletions nat_gateway.tf

This file was deleted.

8 changes: 0 additions & 8 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ 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
6 changes: 6 additions & 0 deletions scale_set.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ resource "azurerm_linux_virtual_machine_scale_set" "sensor_scale_set" {
}

health_probe_id = azurerm_lb_probe.sensor_health_check_probe.id
upgrade_mode = "Automatic"

network_interface {
name = "management-nic"
primary = true
Expand Down Expand Up @@ -51,6 +53,10 @@ resource "azurerm_linux_virtual_machine_scale_set" "sensor_scale_set" {
}

tags = var.tags

depends_on = [
azurerm_lb_rule.monitoring_health_check_rule,
]
}

resource "azurerm_monitor_autoscale_setting" "auto_scale_config" {
Expand Down
12 changes: 0 additions & 12 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,6 @@ 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 08bd973

Please sign in to comment.