azurerm_windows_virtual_machine_scale_set

Manages a Windows Virtual Machine Scale Set.

Disclaimers

Example Usage

This example provisions a basic Windows Virtual Machine Scale Set on an internal network. Additional examples of how to use the azurerm_windows_virtual_machine_scale_set resource can be found in the ./examples/vm-scale-set/windows` directory within the Github Repository.

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_virtual_network" "example" {
  name                = "example-network"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  address_space       = ["10.0.0.0/16"]
}

resource "azurerm_subnet" "internal" {
  name                 = "internal"
  resource_group_name  = azurerm_resource_group.example.name
  virtual_network_name = azurerm_virtual_network.example.name
  address_prefixes     = ["10.0.2.0/24"]
}

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_F2"
  instances            = 1
  admin_password       = "P@55w0rd1234!"
  admin_username       = "adminuser"
  computer_name_prefix = "vm-"

  source_image_reference {
    publisher = "MicrosoftWindowsServer"
    offer     = "WindowsServer"
    sku       = "2016-Datacenter-Server-Core"
    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
    }
  }
}

Argument Reference



An additional_capabilities block supports the following:


An additional_unattend_content block supports the following:


An automatic_os_upgrade_policy block supports the following:


An automatic_instance_repair block supports the following:


A boot_diagnostics block supports the following:


A certificate block supports the following:


A data_disk block supports the following:


A diff_disk_settings block supports the following:


An extension block supports the following:


A gallery_application block supports the following:


An identity block supports the following:


An ip_configuration block supports the following:


An ip_tag block supports the following:


A network_interface block supports the following:


An os_disk block supports the following:


A plan block supports the following:


A scale_in block supports the following:


A protected_settings_from_key_vault block supports the following:


A public_ip_address block supports the following:


A rolling_upgrade_policy block supports the following:


A secret block supports the following:


A terminate_notification block supports the following:


A termination_notification block supports the following:


A winrm_listener block supports the following:


A source_image_reference block supports the following:


A spot_restore block supports the following:


Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:


A identity block exports the following:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

Windows Virtual Machine Scale Sets can be imported using the resource id, e.g.

terraform import azurerm_windows_virtual_machine_scale_set.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachineScaleSets/scaleset1