Linux Virtual Machine Scale Set Args
Manages a Linux Virtual Machine Scale Set.
Disclaimers
Note: As of the v2.86.0 (November 19, 2021) release of the provider this resource will only create Virtual Machine Scale Sets with the Uniform Orchestration Mode. For Virtual Machine Scale Sets with Flexible orchestration mode, use
azure.compute.OrchestratedVirtualMachineScaleSet
. Flexible orchestration mode is recommended for workloads on Azure. rraform will automatically update & reimage the nodes in the Scale Set (if Required) during an Update - this behaviour can be configured using thefeatures
setting within the Provider block.
Example Usage
This example provisions a basic Linux Virtual Machine Scale Set on an internal network.
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const firstPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com";
const example = new azure.core.ResourceGroup("example", {
name: "example-resources",
location: "West Europe",
});
const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
name: "example-network",
resourceGroupName: example.name,
location: example.location,
addressSpaces: ["10.0.0.0/16"],
});
const internal = new azure.network.Subnet("internal", {
name: "internal",
resourceGroupName: example.name,
virtualNetworkName: exampleVirtualNetwork.name,
addressPrefixes: ["10.0.2.0/24"],
});
const exampleLinuxVirtualMachineScaleSet = new azure.compute.LinuxVirtualMachineScaleSet("example", {
name: "example-vmss",
resourceGroupName: example.name,
location: example.location,
sku: "Standard_F2",
instances: 1,
adminUsername: "adminuser",
adminSshKeys: [{
username: "adminuser",
publicKey: firstPublicKey,
}],
sourceImageReference: {
publisher: "Canonical",
offer: "0001-com-ubuntu-server-jammy",
sku: "22_04-lts",
version: "latest",
},
osDisk: {
storageAccountType: "Standard_LRS",
caching: "ReadWrite",
},
networkInterfaces: [{
name: "example",
primary: true,
ipConfigurations: [{
name: "internal",
primary: true,
subnetId: internal.id,
}],
}],
});
import pulumi
import pulumi_azure as azure
first_public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
example_virtual_network = azure.network.VirtualNetwork("example",
name="example-network",
resource_group_name=example.name,
location=example.location,
address_spaces=["10.0.0.0/16"])
internal = azure.network.Subnet("internal",
name="internal",
resource_group_name=example.name,
virtual_network_name=example_virtual_network.name,
address_prefixes=["10.0.2.0/24"])
example_linux_virtual_machine_scale_set = azure.compute.LinuxVirtualMachineScaleSet("example",
name="example-vmss",
resource_group_name=example.name,
location=example.location,
sku="Standard_F2",
instances=1,
admin_username="adminuser",
admin_ssh_keys=[{
"username": "adminuser",
"public_key": first_public_key,
}],
source_image_reference={
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-jammy",
"sku": "22_04-lts",
"version": "latest",
},
os_disk={
"storage_account_type": "Standard_LRS",
"caching": "ReadWrite",
},
network_interfaces=[{
"name": "example",
"primary": True,
"ip_configurations": [{
"name": "internal",
"primary": True,
"subnet_id": internal.id,
}],
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var firstPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com";
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-resources",
Location = "West Europe",
});
var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
{
Name = "example-network",
ResourceGroupName = example.Name,
Location = example.Location,
AddressSpaces = new[]
{
"10.0.0.0/16",
},
});
var @internal = new Azure.Network.Subnet("internal", new()
{
Name = "internal",
ResourceGroupName = example.Name,
VirtualNetworkName = exampleVirtualNetwork.Name,
AddressPrefixes = new[]
{
"10.0.2.0/24",
},
});
var exampleLinuxVirtualMachineScaleSet = new Azure.Compute.LinuxVirtualMachineScaleSet("example", new()
{
Name = "example-vmss",
ResourceGroupName = example.Name,
Location = example.Location,
Sku = "Standard_F2",
Instances = 1,
AdminUsername = "adminuser",
AdminSshKeys = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetAdminSshKeyArgs
{
Username = "adminuser",
PublicKey = firstPublicKey,
},
},
SourceImageReference = new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetSourceImageReferenceArgs
{
Publisher = "Canonical",
Offer = "0001-com-ubuntu-server-jammy",
Sku = "22_04-lts",
Version = "latest",
},
OsDisk = new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetOsDiskArgs
{
StorageAccountType = "Standard_LRS",
Caching = "ReadWrite",
},
NetworkInterfaces = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetNetworkInterfaceArgs
{
Name = "example",
Primary = true,
IpConfigurations = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs
{
Name = "internal",
Primary = true,
SubnetId = @internal.Id,
},
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
firstPublicKey := "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-resources"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
Name: pulumi.String("example-network"),
ResourceGroupName: example.Name,
Location: example.Location,
AddressSpaces: pulumi.StringArray{
pulumi.String("10.0.0.0/16"),
},
})
if err != nil {
return err
}
internal, err := network.NewSubnet(ctx, "internal", &network.SubnetArgs{
Name: pulumi.String("internal"),
ResourceGroupName: example.Name,
VirtualNetworkName: exampleVirtualNetwork.Name,
AddressPrefixes: pulumi.StringArray{
pulumi.String("10.0.2.0/24"),
},
})
if err != nil {
return err
}
_, err = compute.NewLinuxVirtualMachineScaleSet(ctx, "example", &compute.LinuxVirtualMachineScaleSetArgs{
Name: pulumi.String("example-vmss"),
ResourceGroupName: example.Name,
Location: example.Location,
Sku: pulumi.String("Standard_F2"),
Instances: pulumi.Int(1),
AdminUsername: pulumi.String("adminuser"),
AdminSshKeys: compute.LinuxVirtualMachineScaleSetAdminSshKeyArray{
&compute.LinuxVirtualMachineScaleSetAdminSshKeyArgs{
Username: pulumi.String("adminuser"),
PublicKey: pulumi.String(firstPublicKey),
},
},
SourceImageReference: &compute.LinuxVirtualMachineScaleSetSourceImageReferenceArgs{
Publisher: pulumi.String("Canonical"),
Offer: pulumi.String("0001-com-ubuntu-server-jammy"),
Sku: pulumi.String("22_04-lts"),
Version: pulumi.String("latest"),
},
OsDisk: &compute.LinuxVirtualMachineScaleSetOsDiskArgs{
StorageAccountType: pulumi.String("Standard_LRS"),
Caching: pulumi.String("ReadWrite"),
},
NetworkInterfaces: compute.LinuxVirtualMachineScaleSetNetworkInterfaceArray{
&compute.LinuxVirtualMachineScaleSetNetworkInterfaceArgs{
Name: pulumi.String("example"),
Primary: pulumi.Bool(true),
IpConfigurations: compute.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArray{
&compute.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs{
Name: pulumi.String("internal"),
Primary: pulumi.Bool(true),
SubnetId: internal.ID(),
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.Subnet;
import com.pulumi.azure.network.SubnetArgs;
import com.pulumi.azure.compute.LinuxVirtualMachineScaleSet;
import com.pulumi.azure.compute.LinuxVirtualMachineScaleSetArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetAdminSshKeyArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetSourceImageReferenceArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetOsDiskArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetNetworkInterfaceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var firstPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com";
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-resources")
.location("West Europe")
.build());
var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.name("example-network")
.resourceGroupName(example.name())
.location(example.location())
.addressSpaces("10.0.0.0/16")
.build());
var internal = new Subnet("internal", SubnetArgs.builder()
.name("internal")
.resourceGroupName(example.name())
.virtualNetworkName(exampleVirtualNetwork.name())
.addressPrefixes("10.0.2.0/24")
.build());
var exampleLinuxVirtualMachineScaleSet = new LinuxVirtualMachineScaleSet("exampleLinuxVirtualMachineScaleSet", LinuxVirtualMachineScaleSetArgs.builder()
.name("example-vmss")
.resourceGroupName(example.name())
.location(example.location())
.sku("Standard_F2")
.instances(1)
.adminUsername("adminuser")
.adminSshKeys(LinuxVirtualMachineScaleSetAdminSshKeyArgs.builder()
.username("adminuser")
.publicKey(firstPublicKey)
.build())
.sourceImageReference(LinuxVirtualMachineScaleSetSourceImageReferenceArgs.builder()
.publisher("Canonical")
.offer("0001-com-ubuntu-server-jammy")
.sku("22_04-lts")
.version("latest")
.build())
.osDisk(LinuxVirtualMachineScaleSetOsDiskArgs.builder()
.storageAccountType("Standard_LRS")
.caching("ReadWrite")
.build())
.networkInterfaces(LinuxVirtualMachineScaleSetNetworkInterfaceArgs.builder()
.name("example")
.primary(true)
.ipConfigurations(LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs.builder()
.name("internal")
.primary(true)
.subnetId(internal.id())
.build())
.build())
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleVirtualNetwork:
type: azure:network:VirtualNetwork
name: example
properties:
name: example-network
resourceGroupName: ${example.name}
location: ${example.location}
addressSpaces:
- 10.0.0.0/16
internal:
type: azure:network:Subnet
properties:
name: internal
resourceGroupName: ${example.name}
virtualNetworkName: ${exampleVirtualNetwork.name}
addressPrefixes:
- 10.0.2.0/24
exampleLinuxVirtualMachineScaleSet:
type: azure:compute:LinuxVirtualMachineScaleSet
name: example
properties:
name: example-vmss
resourceGroupName: ${example.name}
location: ${example.location}
sku: Standard_F2
instances: 1
adminUsername: adminuser
adminSshKeys:
- username: adminuser
publicKey: ${firstPublicKey}
sourceImageReference:
publisher: Canonical
offer: 0001-com-ubuntu-server-jammy
sku: 22_04-lts
version: latest
osDisk:
storageAccountType: Standard_LRS
caching: ReadWrite
networkInterfaces:
- name: example
primary: true
ipConfigurations:
- name: internal
primary: true
subnetId: ${internal.id}
variables:
firstPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com
Import
Linux Virtual Machine Scale Sets can be imported using the resource id
, e.g.
$ pulumi import azure:compute/linuxVirtualMachineScaleSet:LinuxVirtualMachineScaleSet example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachineScaleSets/scaleset1
Constructors
Properties
An additional_capabilities
block as defined below.
The Password which should be used for the local-administrator on this Virtual Machine. Changing this forces a new resource to be created.
One or more admin_ssh_key
blocks as defined below.
The username of the local administrator on each Virtual Machine Scale Set instance. Changing this forces a new resource to be created.
An automatic_instance_repair
block as defined below. To enable the automatic instance repair, this Virtual Machine Scale Set must have a valid health_probe_id
or an Application Health Extension.
An automatic_os_upgrade_policy
block as defined below. This can only be specified when upgrade_mode
is set to either Automatic
or Rolling
.
A boot_diagnostics
block as defined below.
Specifies the ID of the Capacity Reservation Group which the Virtual Machine Scale Set should be allocated to. Changing this forces a new resource to be created.
The prefix which should be used for the name of the Virtual Machines in this Scale Set. If unspecified this defaults to the value for the name
field. If the value of the name
field is not a valid computer_name_prefix
, then you must specify computer_name_prefix
. Changing this forces a new resource to be created.
The Base64-Encoded Custom Data which should be used for this Virtual Machine Scale Set.
One or more data_disk
blocks as defined below.
Should Password Authentication be disabled on this Virtual Machine Scale Set? Defaults to true
.
Should Virtual Machine Extensions be run on Overprovisioned Virtual Machines in the Scale Set? Defaults to false
.
Should all of the disks (including the temp disk) attached to this Virtual Machine be encrypted by enabling Encryption at Host?
Specifies the eviction policy for Virtual Machines in this Scale Set. Possible values are Deallocate
and Delete
. Changing this forces a new resource to be created.
Should extension operations be allowed on the Virtual Machine Scale Set? Possible values are true
or false
. Defaults to true
. Changing this forces a new Linux Virtual Machine Scale Set to be created.
One or more extension
blocks as defined below
Specifies the duration allocated for all extensions to start. The time duration should be between 15
minutes and 120
minutes (inclusive) and should be specified in ISO 8601 format. Defaults to PT1H30M
.
One or more gallery_application
blocks as defined below.
The ID of a Load Balancer Probe which should be used to determine the health of an instance. This is Required and can only be specified when upgrade_mode
is set to Automatic
or Rolling
.
Specifies the ID of the dedicated host group that the virtual machine scale set resides in. Changing this forces a new resource to be created.
An identity
block as defined below.
The maximum price you're willing to pay for each Virtual Machine in this Scale Set, in US Dollars; which must be greater than the current spot price. If this bid price falls below the current spot price the Virtual Machines in the Scale Set will be evicted using the eviction_policy
. Defaults to -1
, which means that each Virtual Machine in this Scale Set should not be evicted for price reasons.
One or more network_interface
blocks as defined below.
An os_disk
block as defined below.
Should Azure over-provision Virtual Machines in this Scale Set? This means that multiple Virtual Machines will be provisioned and Azure will keep the instances which become available first - which improves provisioning success rates and improves deployment time. You're not billed for these over-provisioned VM's and they don't count towards the Subscription Quota. Defaults to true
.
A plan
block as defined below. Changing this forces a new resource to be created.
Specifies the number of fault domains that are used by this Linux Virtual Machine Scale Set. Changing this forces a new resource to be created.
Should the Azure VM Agent be provisioned on each Virtual Machine in the Scale Set? Defaults to true
. Changing this value forces a new resource to be created.
The ID of the Proximity Placement Group in which the Virtual Machine Scale Set should be assigned to. Changing this forces a new resource to be created.
The name of the Resource Group in which the Linux Virtual Machine Scale Set should be exist. Changing this forces a new resource to be created.
A rolling_upgrade_policy
block as defined below. This is Required and can only be specified when upgrade_mode
is set to Automatic
or Rolling
. Changing this forces a new resource to be created.
A scale_in
block as defined below.
One or more secret
blocks as defined below.
Specifies whether secure boot should be enabled on the virtual machine. Changing this forces a new resource to be created.
Should this Virtual Machine Scale Set be limited to a Single Placement Group, which means the number of instances will be capped at 100 Virtual Machines. Defaults to true
.
The ID of an Image which each Virtual Machine in this Scale Set should be based on. Possible Image ID types include Image ID
, Shared Image ID
, Shared Image Version ID
, Community Gallery Image ID
, Community Gallery Image Version ID
, Shared Gallery Image ID
and Shared Gallery Image Version ID
.
A source_image_reference
block as defined below.
A spot_restore
block as defined below.
A termination_notification
block as defined below.
Specifies whether vTPM should be enabled on the virtual machine. Changing this forces a new resource to be created.
Should the Virtual Machines in this Scale Set be strictly evenly distributed across Availability Zones? Defaults to false
. Changing this forces a new resource to be created.