azurestack_windows_virtual_machine

Manages a Windows Virtual Machine.

Disclaimers

Example Usage

This example provisions a basic Windows Virtual Machine on an internal network. Additional examples of how to use the azurestack_windows_virtual_machine resource can be found in the ./examples/virtual-machines/windows directory within the Github Repository.

provider "azurestack" {
  features {}
}

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

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

resource "azurestack_subnet" "example" {
  name                 = "internal"
  resource_group_name  = azurestack_resource_group.example.name
  virtual_network_name = azurestack_virtual_network.example.name
  address_prefixes     = ["10.0.2.0/24"]
}

resource "azurestack_network_interface" "example" {
  name                = "example-nic"
  location            = azurestack_resource_group.example.location
  resource_group_name = azurestack_resource_group.example.name

  ip_configuration {
    name                          = "internal"
    subnet_id                     = azurestack_subnet.example.id
    private_ip_address_allocation = "Dynamic"
  }
}

resource "azurestack_windows_virtual_machine" "example" {
  name                = "example-machine"
  resource_group_name = azurestack_resource_group.example.name
  location            = azurestack_resource_group.example.location
  size                = "Standard_F2"
  admin_username      = "adminuser"
  admin_password      = "P@$$w0rd1234!"
  network_interface_ids = [
    azurestack_network_interface.example.id,
  ]

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

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

Argument Reference

The following arguments are supported:



A additional_capabilities block supports the following:


A additional_unattend_content block supports the following:


A boot_diagnostics block supports the following:


A certificate block supports the following:


A diff_disk_settings block supports the following:

A os_disk block supports the following:


A plan block supports the following:


A secret block supports the following:


source_image_reference supports the following:


A winrm_listener block supports the following:

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Timeouts

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

Import

Windows Virtual Machines can be imported using the resource id, e.g.

terraform import azurestack_windows_virtual_machine.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/machine1