Expand description
Manages a virtual machine scale set.
§Example Usage
§With Managed Disks (Recommended)
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleVirtualNetwork:
type: azure:network:VirtualNetwork
name: example
properties:
name: acctvn
addressSpaces:
- 10.0.0.0/16
location: ${example.location}
resourceGroupName: ${example.name}
exampleSubnet:
type: azure:network:Subnet
name: example
properties:
name: acctsub
resourceGroupName: ${example.name}
virtualNetworkName: ${exampleVirtualNetwork.name}
addressPrefixes:
- 10.0.2.0/24
examplePublicIp:
type: azure:network:PublicIp
name: example
properties:
name: test
location: ${example.location}
resourceGroupName: ${example.name}
allocationMethod: Static
domainNameLabel: ${example.name}
tags:
environment: staging
exampleLoadBalancer:
type: azure:lb:LoadBalancer
name: example
properties:
name: test
location: ${example.location}
resourceGroupName: ${example.name}
frontendIpConfigurations:
- name: PublicIPAddress
publicIpAddressId: ${examplePublicIp.id}
bpepool:
type: azure:lb:BackendAddressPool
properties:
loadbalancerId: ${exampleLoadBalancer.id}
name: BackEndAddressPool
lbnatpool:
type: azure:lb:NatPool
properties:
resourceGroupName: ${example.name}
name: ssh
loadbalancerId: ${exampleLoadBalancer.id}
protocol: Tcp
frontendPortStart: 50000
frontendPortEnd: 50119
backendPort: 22
frontendIpConfigurationName: PublicIPAddress
exampleProbe:
type: azure:lb:Probe
name: example
properties:
loadbalancerId: ${exampleLoadBalancer.id}
name: http-probe
protocol: Http
requestPath: /health
port: 8080
exampleScaleSet:
type: azure:compute:ScaleSet
name: example
properties:
name: mytestscaleset-1
location: ${example.location}
resourceGroupName: ${example.name}
automaticOsUpgrade: true
upgradePolicyMode: Rolling
rollingUpgradePolicy:
maxBatchInstancePercent: 20
maxUnhealthyInstancePercent: 20
maxUnhealthyUpgradedInstancePercent: 5
pauseTimeBetweenBatches: PT0S
healthProbeId: ${exampleProbe.id}
sku:
name: Standard_F2
tier: Standard
capacity: 2
storageProfileImageReference:
publisher: Canonical
offer: 0001-com-ubuntu-server-jammy
sku: 22_04-lts
version: latest
storageProfileOsDisk:
name: ""
caching: ReadWrite
createOption: FromImage
managedDiskType: Standard_LRS
storageProfileDataDisks:
- lun: 0
caching: ReadWrite
createOption: Empty
diskSizeGb: 10
osProfile:
computerNamePrefix: testvm
adminUsername: myadmin
osProfileLinuxConfig:
disablePasswordAuthentication: true
sshKeys:
- path: /home/myadmin/.ssh/authorized_keys
keyData:
fn::invoke:
function: std:file
arguments:
input: ~/.ssh/demo_key.pub
return: result
networkProfiles:
- name: mynetworkprofile
primary: true
ipConfigurations:
- name: TestIPConfiguration
primary: true
subnetId: ${exampleSubnet.id}
loadBalancerBackendAddressPoolIds:
- ${bpepool.id}
loadBalancerInboundNatRulesIds:
- ${lbnatpool.id}
tags:
environment: staging
§With Unmanaged Disks
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleVirtualNetwork:
type: azure:network:VirtualNetwork
name: example
properties:
name: acctvn
addressSpaces:
- 10.0.0.0/16
location: ${example.location}
resourceGroupName: ${example.name}
exampleSubnet:
type: azure:network:Subnet
name: example
properties:
name: acctsub
resourceGroupName: ${example.name}
virtualNetworkName: ${exampleVirtualNetwork.name}
addressPrefixes:
- 10.0.2.0/24
exampleAccount:
type: azure:storage:Account
name: example
properties:
name: accsa
resourceGroupName: ${example.name}
location: ${example.location}
accountTier: Standard
accountReplicationType: LRS
tags:
environment: staging
exampleContainer:
type: azure:storage:Container
name: example
properties:
name: vhds
storageAccountName: ${exampleAccount.name}
containerAccessType: private
exampleScaleSet:
type: azure:compute:ScaleSet
name: example
properties:
name: mytestscaleset-1
location: ${example.location}
resourceGroupName: ${example.name}
upgradePolicyMode: Manual
sku:
name: Standard_F2
tier: Standard
capacity: 2
osProfile:
computerNamePrefix: testvm
adminUsername: myadmin
osProfileLinuxConfig:
disablePasswordAuthentication: true
sshKeys:
- path: /home/myadmin/.ssh/authorized_keys
keyData:
fn::invoke:
function: std:file
arguments:
input: ~/.ssh/demo_key.pub
return: result
networkProfiles:
- name: TestNetworkProfile
primary: true
ipConfigurations:
- name: TestIPConfiguration
primary: true
subnetId: ${exampleSubnet.id}
storageProfileOsDisk:
name: osDiskProfile
caching: ReadWrite
createOption: FromImage
vhdContainers:
- ${exampleAccount.primaryBlobEndpoint}${exampleContainer.name}
storageProfileImageReference:
publisher: Canonical
offer: 0001-com-ubuntu-server-jammy
sku: 22_04-lts
version: latest
§Example of storage_profile_image_reference with id
ⓘ
use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
let example = image::create(
"example",
ImageArgs::builder().name("test").build_struct(),
);
let exampleScaleSet = scale_set::create(
"exampleScaleSet",
ScaleSetArgs::builder()
.name("test")
.storage_profile_image_reference(
ScaleSetStorageProfileImageReference::builder()
.id("${example.id}")
.build_struct(),
)
.build_struct(),
);
}
§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
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments