pulumi_wasm_providers_azure_mini::compute

Module linux_virtual_machine

source
Expand description

Manages a Linux Virtual Machine.

§Disclaimers

Note This provider will automatically remove the OS Disk by default - this behaviour can be configured using the features configuration within the Provider configuration block.

Note All arguments including the administrator login and password will be stored in the raw state as plain-text.

Note This resource does not support Unmanaged Disks. If you need to use Unmanaged Disks you can continue to use the azure.compute.VirtualMachine resource instead.

Note This resource does not support attaching existing OS Disks. You can instead capture an image of the OS Disk or continue to use the azure.compute.VirtualMachine resource instead.

In this release there’s a known issue where the public_ip_address and public_ip_addresses fields may not be fully populated for Dynamic Public IP’s.

§Example Usage

This example provisions a basic Linux Virtual Machine on an internal network.

resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleVirtualNetwork:
    type: azure:network:VirtualNetwork
    name: example
    properties:
      name: example-network
      addressSpaces:
        - 10.0.0.0/16
      location: ${example.location}
      resourceGroupName: ${example.name}
  exampleSubnet:
    type: azure:network:Subnet
    name: example
    properties:
      name: internal
      resourceGroupName: ${example.name}
      virtualNetworkName: ${exampleVirtualNetwork.name}
      addressPrefixes:
        - 10.0.2.0/24
  exampleNetworkInterface:
    type: azure:network:NetworkInterface
    name: example
    properties:
      name: example-nic
      location: ${example.location}
      resourceGroupName: ${example.name}
      ipConfigurations:
        - name: internal
          subnetId: ${exampleSubnet.id}
          privateIpAddressAllocation: Dynamic
  exampleLinuxVirtualMachine:
    type: azure:compute:LinuxVirtualMachine
    name: example
    properties:
      name: example-machine
      resourceGroupName: ${example.name}
      location: ${example.location}
      size: Standard_F2
      adminUsername: adminuser
      networkInterfaceIds:
        - ${exampleNetworkInterface.id}
      adminSshKeys:
        - username: adminuser
          publicKey:
            fn::invoke:
              function: std:file
              arguments:
                input: ~/.ssh/id_rsa.pub
              return: result
      osDisk:
        caching: ReadWrite
        storageAccountType: Standard_LRS
      sourceImageReference:
        publisher: Canonical
        offer: 0001-com-ubuntu-server-jammy
        sku: 22_04-lts
        version: latest

§Import

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

$ pulumi import azure:compute/linuxVirtualMachine:LinuxVirtualMachine example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/machine1

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments