I am running a VMScaleSet with Ubuntu instances.
Also I have a customScript extension set up in terraform like this:
resource "azurerm_virtual_machine_scale_set_extension" "customScriptExtension" {
name = "my-cs-ext"
virtual_machine_scale_set_id = azurerm_linux_virtual_machine_scale_set.vmss.id
publisher = "Microsoft.Azure.Extensions"
type = "CustomScript"
type_handler_version = "2.0"
settings = jsonencode({
"commandToExecute" = "sh init.sh"
"fileUris" = ["storageurlToDownloadfrom/foo.txt?sas_token"]
})
}
This kinda works, as everythin gets provisioned, and the VMSS is running fine. But the customScript
is not being executed automatically after starting the VMSS.
I always have to manually press the "upgrade" button for the selected VMSS-instances, then it works (means the commandToExecute is being executed).
I need to have this script run automatically when a new instance starts, as this is especially relevant for scaling out the vmss.
I expected the customScript to be used for exactly this and in Videos I watched, the customScript was executed automatically. At least I have seen this working for VMs, not yet for VMSS, but there shouldn't be a difference, right?
Hope anyone can help me :)))