pulumi_wasm_providers_azure_mini::compute

Module virtual_machine

source
Expand description

Manages a Virtual Machine.

§Disclaimers

Note: The azure.compute.VirtualMachine resource has been superseded by the azure.compute.LinuxVirtualMachine and azure.compute.WindowsVirtualMachine resources. The existing azure.compute.VirtualMachine resource will continue to be available throughout the 2.x releases however is in a feature-frozen state to maintain compatibility - new functionality will instead be added to the azure.compute.LinuxVirtualMachine and azure.compute.WindowsVirtualMachine resources.

Note: Data Disks can be attached either directly on the azure.compute.VirtualMachine resource, or using the azure.compute.DataDiskAttachment resource - but the two cannot be used together. If both are used against the same Virtual Machine, spurious changes will occur.

§Example Usage

§From An Azure Platform Image)

This example provisions a Virtual Machine with Managed Disks.

configuration:
  prefix:
    type: string
    default: tfvmex
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: ${prefix}-resources
      location: West Europe
  main:
    type: azure:network:VirtualNetwork
    properties:
      name: ${prefix}-network
      addressSpaces:
        - 10.0.0.0/16
      location: ${example.location}
      resourceGroupName: ${example.name}
  internal:
    type: azure:network:Subnet
    properties:
      name: internal
      resourceGroupName: ${example.name}
      virtualNetworkName: ${main.name}
      addressPrefixes:
        - 10.0.2.0/24
  mainNetworkInterface:
    type: azure:network:NetworkInterface
    name: main
    properties:
      name: ${prefix}-nic
      location: ${example.location}
      resourceGroupName: ${example.name}
      ipConfigurations:
        - name: testconfiguration1
          subnetId: ${internal.id}
          privateIpAddressAllocation: Dynamic
  mainVirtualMachine:
    type: azure:compute:VirtualMachine
    name: main
    properties:
      name: ${prefix}-vm
      location: ${example.location}
      resourceGroupName: ${example.name}
      networkInterfaceIds:
        - ${mainNetworkInterface.id}
      vmSize: Standard_DS1_v2
      storageImageReference:
        publisher: Canonical
        offer: 0001-com-ubuntu-server-jammy
        sku: 22_04-lts
        version: latest
      storageOsDisk:
        name: myosdisk1
        caching: ReadWrite
        createOption: FromImage
        managedDiskType: Standard_LRS
      osProfile:
        computerName: hostname
        adminUsername: testadmin
        adminPassword: Password1234!
      osProfileLinuxConfig:
        disablePasswordAuthentication: false
      tags:
        environment: staging

§Import

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

$ pulumi import azure:compute/virtualMachine:VirtualMachine 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