Skip to content

Commit

Permalink
feat: add the replacement of the scale set when the user data changes
Browse files Browse the repository at this point in the history
this is to make sure that any config changes come through in the VM

closes #1
  • Loading branch information
rickmoonex committed Jan 25, 2023
1 parent 9df782b commit 5f91d6f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
resource "null_resource" "user_data" {
triggers = {
user_data = var.user_data
}
}

resource "azurerm_linux_virtual_machine_scale_set" "vault_cluster" {
admin_username = var.ssh_username
instances = var.instance_count
Expand Down Expand Up @@ -59,6 +65,12 @@ resource "azurerm_linux_virtual_machine_scale_set" "vault_cluster" {
},
var.common_tags
)

lifecycle {
replace_triggered_by = [
null_resource.user_data
]
}
}

resource "azurerm_virtual_machine_scale_set_extension" "vault_health" {
Expand Down

0 comments on commit 5f91d6f

Please sign in to comment.