azurerm_virtual_machine_extension
azurerm_virtual_machine
resource "azurerm_virtual_machine_extension" "monitoringagent" {
name = "OmsAgentForLinux"
location = azurerm_resource_group.vm.location
resource_group_name = azurerm_resource_group.vm.name
virtual_machine_name = azurerm_virtual_machine.vm.name
publisher = "Microsoft.EnterpriseCloud.Monitoring"
type = "OmsAgentForLinux"
type_handler_version = "1.11"
auto_upgrade_minor_version = true
settings = jsonencode({workspaceId : var.oms_workspaceId})
protected_settings = jsonencode({workspaceKey : var.oms_workspaceKey})
}
When I taint the VM, I expect the extension to be removed and reinstalled.
Terraform just wants to destroy/create the VM, which gives me a shiny new VM without the extension.
terraform apply
As a workaround, we add a tag to the VM like
resource "azurerm_virtual_machine" "vm" {
lifecycle {
ignore_changes = ["tags"]
}
tags {
created = "${timestamp()}"
}
and use the value of this tag in the extensionname
resource "azurerm_virtual_machine_extension" "vmExtOms" {
depends_on = ["azurerm_virtual_machine.vm"]
name = "OMS_${replace(azurerm_virtual_machine.vm.tags.created, ":", ".")}"
๐
Taking a look through here it appears this'll be fixed via #2456 - rather than having multiple issues open tracking the same thing I'm going to close this issue in favour of that one; would you mind subscribing to #2456 for updates?
Thanks!
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error ๐ค ๐ , please reach out to my human friends ๐ [email protected]. Thanks!
Most helpful comment
As a workaround, we add a tag to the VM like
and use the value of this tag in the extensionname