terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

`azurerm_linux_virtual_machine`not setting `vm_agent_platform_updates_enabled` correctly

Open alexkunde opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.9.6

AzureRM Provider Version

4.3.0

Affected Resource(s)/Data Source(s)

azurerm_linux_virtual_machine

Terraform Configuration Files

resource "azurerm_linux_virtual_machine" "management" {
  name                              = "dev-management-vm"
  resource_group_name               = var.resource_group.name
  location                          = var.resource_group.location
  size                              = var.vm_sku
  admin_username                    = "admin"
  disable_password_authentication   = true
  patch_assessment_mode             = "AutomaticByPlatform"
  patch_mode                        = "AutomaticByPlatform"
  provision_vm_agent                = true
  allow_extension_operations        = true
  vm_agent_platform_updates_enabled = true
  encryption_at_host_enabled        = true
  network_interface_ids = [
    azurerm_network_interface.management.id,
  ]

  admin_ssh_key {
    username   = "pacman"
    public_key = var.public_key_openssh
  }

  identity {
    type = "SystemAssigned"
  }

  os_disk {
    caching              = "ReadWrite"
    storage_account_type = "Standard_LRS"
    disk_size_gb         = var.vm_disk_size
  }

  source_image_reference {
    publisher = "Canonical"
    offer     = "0001-com-ubuntu-server-jammy"
    sku       = "22_04-lts"
    version   = "latest"
  }
}

Debug Output/Panic Output

from terraform plan:

resource "azurerm_linux_virtual_machine" "management" {
        id                                                     = "/subscriptions/1234/resourceGroups/dev-rg/providers/Microsoft.Compute/virtualMachines/dev-management-vm"
        name                                                   = "dev-management-vm"
      ~ vm_agent_platform_updates_enabled                      = false -> true
}

from Azure Api:
GET https://management.azure.com/subscriptions/1234/resourceGroups/dev-rg/providers/Microsoft.Compute/virtualMachines/dev-management-vm?api-version=2023-03-01


"provisionVMAgent": true,
  "patchSettings": {
     "patchMode": "AutomaticByPlatform",
     "automaticByPlatformSettings": {
        "bypassPlatformSafetyChecksOnUserSchedule": false
     },
     "assessmentMode": "AutomaticByPlatform"
  },
"enableVMAgentPlatformUpdates": true

Expected Behaviour

vm_agent_platform_updates_enabled should be true as it is already set true on the resource

Actual Behaviour

vm_agent_platform_updates_enabled is seen by Terraform as false but it is set true on the resource

Steps to Reproduce

terraform plan

Important Factoids

No response

References

No response

alexkunde avatar Sep 24 '24 12:09 alexkunde