azurestack_linux_virtual_machine

Manages a Linux Virtual Machine.

Disclaimers

Example Usage

This example provisions a basic Linux Virtual Machine on an internal network. Additional examples of how to use the azurestack_linux_virtual_machine resource can be found in the ./examples/virtual-machines/linux 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_linux_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"
  network_interface_ids = [
    azurestack_network_interface.example.id,
  ]

  admin_ssh_key {
    username   = "adminuser"
    public_key = file("~/.ssh/id_rsa.pub")
  }

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

  source_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "16.04-LTS"
    version   = "latest"
  }
}

Argument Reference

The following arguments are supported:



A additional_capabilities block supports the following:


A admin_ssh_key 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:

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

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

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