ScaleSetArgs

data class ScaleSetArgs(val automaticOsUpgrade: Output<Boolean>? = null, val bootDiagnostics: Output<ScaleSetBootDiagnosticsArgs>? = null, val evictionPolicy: Output<String>? = null, val extensions: Output<List<ScaleSetExtensionArgs>>? = null, val healthProbeId: Output<String>? = null, val identity: Output<ScaleSetIdentityArgs>? = null, val licenseType: Output<String>? = null, val location: Output<String>? = null, val name: Output<String>? = null, val networkProfiles: Output<List<ScaleSetNetworkProfileArgs>>? = null, val osProfile: Output<ScaleSetOsProfileArgs>? = null, val osProfileLinuxConfig: Output<ScaleSetOsProfileLinuxConfigArgs>? = null, val osProfileSecrets: Output<List<ScaleSetOsProfileSecretArgs>>? = null, val osProfileWindowsConfig: Output<ScaleSetOsProfileWindowsConfigArgs>? = null, val overprovision: Output<Boolean>? = null, val plan: Output<ScaleSetPlanArgs>? = null, val priority: Output<String>? = null, val proximityPlacementGroupId: Output<String>? = null, val resourceGroupName: Output<String>? = null, val rollingUpgradePolicy: Output<ScaleSetRollingUpgradePolicyArgs>? = null, val singlePlacementGroup: Output<Boolean>? = null, val sku: Output<ScaleSetSkuArgs>? = null, val storageProfileDataDisks: Output<List<ScaleSetStorageProfileDataDiskArgs>>? = null, val storageProfileImageReference: Output<ScaleSetStorageProfileImageReferenceArgs>? = null, val storageProfileOsDisk: Output<ScaleSetStorageProfileOsDiskArgs>? = null, val tags: Output<Map<String, String>>? = null, val upgradePolicyMode: Output<String>? = null, val zones: Output<List<String>>? = null) : ConvertibleToJava<ScaleSetArgs>

Manages a virtual machine scale set.

Example Usage

With Managed Disks (Recommended)

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.network.PublicIp;
import com.pulumi.azure.network.PublicIpArgs;
import com.pulumi.azure.lb.LoadBalancer;
import com.pulumi.azure.lb.LoadBalancerArgs;
import com.pulumi.azure.lb.inputs.LoadBalancerFrontendIpConfigurationArgs;
import com.pulumi.azure.lb.BackendAddressPool;
import com.pulumi.azure.lb.BackendAddressPoolArgs;
import com.pulumi.azure.lb.NatPool;
import com.pulumi.azure.lb.NatPoolArgs;
import com.pulumi.azure.lb.Probe;
import com.pulumi.azure.lb.ProbeArgs;
import com.pulumi.azure.compute.ScaleSet;
import com.pulumi.azure.compute.ScaleSetArgs;
import com.pulumi.azure.compute.inputs.ScaleSetRollingUpgradePolicyArgs;
import com.pulumi.azure.compute.inputs.ScaleSetSkuArgs;
import com.pulumi.azure.compute.inputs.ScaleSetStorageProfileImageReferenceArgs;
import com.pulumi.azure.compute.inputs.ScaleSetStorageProfileOsDiskArgs;
import com.pulumi.azure.compute.inputs.ScaleSetStorageProfileDataDiskArgs;
import com.pulumi.azure.compute.inputs.ScaleSetOsProfileArgs;
import com.pulumi.azure.compute.inputs.ScaleSetOsProfileLinuxConfigArgs;
import com.pulumi.azure.compute.inputs.ScaleSetNetworkProfileArgs;
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) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.addressSpaces("10.0.0.0/16")
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.build());
var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.virtualNetworkName(exampleVirtualNetwork.name())
.addressPrefixes("10.0.2.0/24")
.build());
var examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.allocationMethod("Static")
.domainNameLabel(exampleResourceGroup.name())
.tags(Map.of("environment", "staging"))
.build());
var exampleLoadBalancer = new LoadBalancer("exampleLoadBalancer", LoadBalancerArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.frontendIpConfigurations(LoadBalancerFrontendIpConfigurationArgs.builder()
.name("PublicIPAddress")
.publicIpAddressId(examplePublicIp.id())
.build())
.build());
var bpepool = new BackendAddressPool("bpepool", BackendAddressPoolArgs.builder()
.loadbalancerId(exampleLoadBalancer.id())
.build());
var lbnatpool = new NatPool("lbnatpool", NatPoolArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.loadbalancerId(exampleLoadBalancer.id())
.protocol("Tcp")
.frontendPortStart(50000)
.frontendPortEnd(50119)
.backendPort(22)
.frontendIpConfigurationName("PublicIPAddress")
.build());
var exampleProbe = new Probe("exampleProbe", ProbeArgs.builder()
.loadbalancerId(exampleLoadBalancer.id())
.protocol("Http")
.requestPath("/health")
.port(8080)
.build());
var exampleScaleSet = new ScaleSet("exampleScaleSet", ScaleSetArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.automaticOsUpgrade(true)
.upgradePolicyMode("Rolling")
.rollingUpgradePolicy(ScaleSetRollingUpgradePolicyArgs.builder()
.maxBatchInstancePercent(20)
.maxUnhealthyInstancePercent(20)
.maxUnhealthyUpgradedInstancePercent(5)
.pauseTimeBetweenBatches("PT0S")
.build())
.healthProbeId(exampleProbe.id())
.sku(ScaleSetSkuArgs.builder()
.name("Standard_F2")
.tier("Standard")
.capacity(2)
.build())
.storageProfileImageReference(ScaleSetStorageProfileImageReferenceArgs.builder()
.publisher("Canonical")
.offer("0001-com-ubuntu-server-focal")
.sku("20_04-lts")
.version("latest")
.build())
.storageProfileOsDisk(ScaleSetStorageProfileOsDiskArgs.builder()
.name("")
.caching("ReadWrite")
.createOption("FromImage")
.managedDiskType("Standard_LRS")
.build())
.storageProfileDataDisks(ScaleSetStorageProfileDataDiskArgs.builder()
.lun(0)
.caching("ReadWrite")
.createOption("Empty")
.diskSizeGb(10)
.build())
.osProfile(ScaleSetOsProfileArgs.builder()
.computerNamePrefix("testvm")
.adminUsername("myadmin")
.build())
.osProfileLinuxConfig(ScaleSetOsProfileLinuxConfigArgs.builder()
.disablePasswordAuthentication(true)
.sshKeys(ScaleSetOsProfileLinuxConfigSshKeyArgs.builder()
.path("/home/myadmin/.ssh/authorized_keys")
.keyData(Files.readString(Paths.get("~/.ssh/demo_key.pub")))
.build())
.build())
.networkProfiles(ScaleSetNetworkProfileArgs.builder()
.name("mynetworkprofile")
.primary(true)
.ipConfigurations(ScaleSetNetworkProfileIpConfigurationArgs.builder()
.name("TestIPConfiguration")
.primary(true)
.subnetId(exampleSubnet.id())
.loadBalancerBackendAddressPoolIds(bpepool.id())
.loadBalancerInboundNatRulesIds(lbnatpool.id())
.build())
.build())
.tags(Map.of("environment", "staging"))
.build());
}
}

With Unmanaged Disks

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.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.storage.Container;
import com.pulumi.azure.storage.ContainerArgs;
import com.pulumi.azure.compute.ScaleSet;
import com.pulumi.azure.compute.ScaleSetArgs;
import com.pulumi.azure.compute.inputs.ScaleSetSkuArgs;
import com.pulumi.azure.compute.inputs.ScaleSetOsProfileArgs;
import com.pulumi.azure.compute.inputs.ScaleSetOsProfileLinuxConfigArgs;
import com.pulumi.azure.compute.inputs.ScaleSetNetworkProfileArgs;
import com.pulumi.azure.compute.inputs.ScaleSetStorageProfileOsDiskArgs;
import com.pulumi.azure.compute.inputs.ScaleSetStorageProfileImageReferenceArgs;
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) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.addressSpaces("10.0.0.0/16")
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.build());
var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.virtualNetworkName(exampleVirtualNetwork.name())
.addressPrefixes("10.0.2.0/24")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.accountTier("Standard")
.accountReplicationType("LRS")
.tags(Map.of("environment", "staging"))
.build());
var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
.storageAccountName(exampleAccount.name())
.containerAccessType("private")
.build());
var exampleScaleSet = new ScaleSet("exampleScaleSet", ScaleSetArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.upgradePolicyMode("Manual")
.sku(ScaleSetSkuArgs.builder()
.name("Standard_F2")
.tier("Standard")
.capacity(2)
.build())
.osProfile(ScaleSetOsProfileArgs.builder()
.computerNamePrefix("testvm")
.adminUsername("myadmin")
.build())
.osProfileLinuxConfig(ScaleSetOsProfileLinuxConfigArgs.builder()
.disablePasswordAuthentication(true)
.sshKeys(ScaleSetOsProfileLinuxConfigSshKeyArgs.builder()
.path("/home/myadmin/.ssh/authorized_keys")
.keyData(Files.readString(Paths.get("~/.ssh/demo_key.pub")))
.build())
.build())
.networkProfiles(ScaleSetNetworkProfileArgs.builder()
.name("TestNetworkProfile")
.primary(true)
.ipConfigurations(ScaleSetNetworkProfileIpConfigurationArgs.builder()
.name("TestIPConfiguration")
.primary(true)
.subnetId(exampleSubnet.id())
.build())
.build())
.storageProfileOsDisk(ScaleSetStorageProfileOsDiskArgs.builder()
.name("osDiskProfile")
.caching("ReadWrite")
.createOption("FromImage")
.vhdContainers(Output.tuple(exampleAccount.primaryBlobEndpoint(), exampleContainer.name()).applyValue(values -> {
var primaryBlobEndpoint = values.t1;
var name = values.t2;
return String.format("%s%s", primaryBlobEndpoint,name);
}))
.build())
.storageProfileImageReference(ScaleSetStorageProfileImageReferenceArgs.builder()
.publisher("Canonical")
.offer("0001-com-ubuntu-server-focal")
.sku("20_04-lts")
.version("latest")
.build())
.build());
}
}

Example of storage_profile_image_reference with id

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleImage = new azure.compute.Image("exampleImage", {});
// ...
const exampleScaleSet = new azure.compute.ScaleSet("exampleScaleSet", {storageProfileImageReference: {
id: exampleImage.id,
}});
// ...
import pulumi
import pulumi_azure as azure
example_image = azure.compute.Image("exampleImage")
# ...
example_scale_set = azure.compute.ScaleSet("exampleScaleSet", storage_profile_image_reference=azure.compute.ScaleSetStorageProfileImageReferenceArgs(
id=example_image.id,
))
# ...
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var exampleImage = new Azure.Compute.Image("exampleImage");
// ...
var exampleScaleSet = new Azure.Compute.ScaleSet("exampleScaleSet", new()
{
StorageProfileImageReference = new Azure.Compute.Inputs.ScaleSetStorageProfileImageReferenceArgs
{
Id = exampleImage.Id,
},
});
// ...
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleImage, err := compute.NewImage(ctx, "exampleImage", nil)
if err != nil {
return err
}
_, err = compute.NewScaleSet(ctx, "exampleScaleSet", &compute.ScaleSetArgs{
StorageProfileImageReference: &compute.ScaleSetStorageProfileImageReferenceArgs{
Id: exampleImage.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.compute.Image;
import com.pulumi.azure.compute.ScaleSet;
import com.pulumi.azure.compute.ScaleSetArgs;
import com.pulumi.azure.compute.inputs.ScaleSetStorageProfileImageReferenceArgs;
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) {
var exampleImage = new Image("exampleImage");
var exampleScaleSet = new ScaleSet("exampleScaleSet", ScaleSetArgs.builder()
.storageProfileImageReference(ScaleSetStorageProfileImageReferenceArgs.builder()
.id(exampleImage.id())
.build())
.build());
}
}
resources:
exampleImage:
type: azure:compute:Image
exampleScaleSet:
type: azure:compute:ScaleSet
properties:
storageProfileImageReference:
id: ${exampleImage.id}

Import

Virtual Machine Scale Sets can be imported using the resource id, e.g.

$ pulumi import azure:compute/scaleSet:ScaleSet scaleset1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachineScaleSets/scaleset1

Constructors

Link copied to clipboard
fun ScaleSetArgs(automaticOsUpgrade: Output<Boolean>? = null, bootDiagnostics: Output<ScaleSetBootDiagnosticsArgs>? = null, evictionPolicy: Output<String>? = null, extensions: Output<List<ScaleSetExtensionArgs>>? = null, healthProbeId: Output<String>? = null, identity: Output<ScaleSetIdentityArgs>? = null, licenseType: Output<String>? = null, location: Output<String>? = null, name: Output<String>? = null, networkProfiles: Output<List<ScaleSetNetworkProfileArgs>>? = null, osProfile: Output<ScaleSetOsProfileArgs>? = null, osProfileLinuxConfig: Output<ScaleSetOsProfileLinuxConfigArgs>? = null, osProfileSecrets: Output<List<ScaleSetOsProfileSecretArgs>>? = null, osProfileWindowsConfig: Output<ScaleSetOsProfileWindowsConfigArgs>? = null, overprovision: Output<Boolean>? = null, plan: Output<ScaleSetPlanArgs>? = null, priority: Output<String>? = null, proximityPlacementGroupId: Output<String>? = null, resourceGroupName: Output<String>? = null, rollingUpgradePolicy: Output<ScaleSetRollingUpgradePolicyArgs>? = null, singlePlacementGroup: Output<Boolean>? = null, sku: Output<ScaleSetSkuArgs>? = null, storageProfileDataDisks: Output<List<ScaleSetStorageProfileDataDiskArgs>>? = null, storageProfileImageReference: Output<ScaleSetStorageProfileImageReferenceArgs>? = null, storageProfileOsDisk: Output<ScaleSetStorageProfileOsDiskArgs>? = null, tags: Output<Map<String, String>>? = null, upgradePolicyMode: Output<String>? = null, zones: Output<List<String>>? = null)

Functions

Link copied to clipboard
open override fun toJava(): ScaleSetArgs

Properties

Link copied to clipboard
val automaticOsUpgrade: Output<Boolean>? = null

Automatic OS patches can be applied by Azure to your scaleset. This is particularly useful when upgrade_policy_mode is set to Rolling. Defaults to false.

Link copied to clipboard

A boot diagnostics profile block as referenced below.

Link copied to clipboard
val evictionPolicy: Output<String>? = null

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.

Link copied to clipboard
val extensions: Output<List<ScaleSetExtensionArgs>>? = null

Can be specified multiple times to add extension profiles to the scale set. Each extension block supports the fields documented below.

Link copied to clipboard
val healthProbeId: Output<String>? = null

Specifies the identifier for the load balancer health probe. Required when using Rolling as your upgrade_policy_mode.

Link copied to clipboard
val identity: Output<ScaleSetIdentityArgs>? = null

An identity block as defined below.

Link copied to clipboard
val licenseType: Output<String>? = null

(Optional, when a Windows machine) Specifies the Windows OS license type. If supplied, the only allowed values are Windows_Client and Windows_Server.

Link copied to clipboard
val location: Output<String>? = null

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Link copied to clipboard
val name: Output<String>? = null

Specifies the name of the virtual machine scale set resource. Changing this forces a new resource to be created.

Link copied to clipboard

A collection of network profile block as documented below.

Link copied to clipboard
val osProfile: Output<ScaleSetOsProfileArgs>? = null

A Virtual Machine OS Profile block as documented below.

Link copied to clipboard

A Linux config block as documented below.

Link copied to clipboard

A collection of Secret blocks as documented below.

Link copied to clipboard

A Windows config block as documented below.

Link copied to clipboard
val overprovision: Output<Boolean>? = null

Specifies whether the virtual machine scale set should be overprovisioned. Defaults to true.

Link copied to clipboard
val plan: Output<ScaleSetPlanArgs>? = null

A plan block as documented below.

Link copied to clipboard
val priority: Output<String>? = null

Specifies the priority for the Virtual Machines in the Scale Set. Possible values are Low and Regular. Changing this forces a new resource to be created.

Link copied to clipboard
val proximityPlacementGroupId: Output<String>? = null

The ID of the Proximity Placement Group to which this Virtual Machine should be assigned. Changing this forces a new resource to be created

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group in which to create the virtual machine scale set. Changing this forces a new resource to be created.

Link copied to clipboard

A rolling_upgrade_policy block as defined below. This is only applicable when the upgrade_policy_mode is Rolling.

Link copied to clipboard
val singlePlacementGroup: Output<Boolean>? = null

Specifies whether the scale set is limited to a single placement group with a maximum size of 100 virtual machines. If set to false, managed disks must be used. Default is true. Changing this forces a new resource to be created. See documentation for more information.

Link copied to clipboard
val sku: Output<ScaleSetSkuArgs>? = null

A SKU block as documented below.

Link copied to clipboard

A storage profile data disk block as documented below

Link copied to clipboard

A storage profile image reference block as documented below.

Link copied to clipboard

A storage profile os disk block as documented below

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A mapping of tags to assign to the resource.

Link copied to clipboard
val upgradePolicyMode: Output<String>? = null

Specifies the mode of an upgrade to virtual machines in the scale set. Possible values, Rolling, Manual, or Automatic. When choosing Rolling, you will need to set a health probe.

Link copied to clipboard
val zones: Output<List<String>>? = null

A collection of availability zones to spread the Virtual Machines over. Changing this forces a new resource to be created.