An argument named "Upgrade_Policy_Mode" is not expected here

were is the correct placement of the option upgrade_policy_mode = “Manual” Within the azurerm_windows_virtual_machine_scale_set resource

Ive complied the following resource options


resource "azurerm_windows_virtual_machine_scale_set" "example" {
  name                = "example-vmss"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  sku                 = "Standard_B1s"
  instances           = 1
  admin_password      = "RandonPassword12345!"
  admin_username      = "adminusername"
  computer_name_prefix = "Win2016"
  enable_automatic_updates  = true

  upgrade_policy_mode  = "Manual"

  source_image_reference {
    publisher = "MicrosoftWindowsServer"
    offer     = "WindowsServer"
    sku       = "2016-Datacenter"
    version   = "latest"
  }

  os_disk {
    storage_account_type = "Standard_LRS"
    caching              = "ReadWrite"
  }

  network_interface {
    name    = "example"
    primary = true

    ip_configuration {
      name      = "internal"
      primary   = true
      subnet_id = azurerm_subnet.internal.id
    }
  }
}

And keep getting the following error

An argument named “Upgrade_Policy_Mode” is not expected here.

where does it go?

Hi @GaryTrembath,

I’m not very familiar with these Azure features in particular, but referring to the docs it seems like upgrade_policy_mode is an argument of azurerm_virtual_machine_scale_set, not of azurerm_windows_virtual_machine_scale_set.

On the page about the Windows-specific resource type I see that there is an argument called upgrade_policy which seems to take similar values. I’m not familiar enough with this provider to say for certain that they are related, but hopefully there’s a solution here using upgrade_policy instead.

Hi,

iam facing similar error while supplying upgrade_mode = “rolling” and getting error

Error: Error creating Windows Virtual Machine Scale Set “WebWvmss1” (Resource Group “v100-rg”): compute.VirtualMachineScaleSetsClient#CreateOrUpdate: Failure sending request: StatusCode=400 – Original Error: Code=“InvalidRequestFormat” Message=“Cannot parse the request.” Details=[{“code”:“InvalidJsonReferenceFormat”,“message”:“Reference Id /subscriptions/1c37ebe3-2c26-4571-a01f-fd2ad4831225/resourceGroups/v100-rg/providers/Microsoft.Network/applicationGateways/v100appgw/probe/v100-gw-probe is not formatted correctly. The Id is expected to reference resources of type loadBalancers/probes. Path Properties.UpdateGroups[0].NetworkProfile.healthProbe.”}]

on main.tf line 297, in resource “azurerm_windows_virtual_machine_scale_set” “Web_Windows_VMSS”:
297: resource “azurerm_windows_virtual_machine_scale_set” “Web_Windows_VMSS” {

iam trying to point App gateway to VMSS

resource “azurerm_windows_virtual_machine_scale_set” “test_VMSS” {
name = “Wvmss1”
resource_group_name = azurerm_resource_group.test.name
location = var.location
sku = “Standard_D2s_v3”
instances = 2
admin_username = " "
admin_password = " "
enable_automatic_updates = “true”
zones = [1, 2, 3]
zone_balance = true
upgrade_mode = “Rolling”
health_probe_id = ["${azurerm_application_gateway.test_application_gateway.id}/probe/test-gw-probe"]

can someone please help me :frowning:

just to add, works fine with upgrade_mode set to manual since health_probe_id not needed.

but facing error while changing upgrade_mode to Rolling