All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.compute.kotlin.WindowsVirtualMachineScaleSet.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.compute.kotlin

import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetAdditionalCapabilities
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetAdditionalUnattendContent
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetAutomaticInstanceRepair
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetAutomaticOsUpgradePolicy
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetBootDiagnostics
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetDataDisk
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetExtension
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetGalleryApplication
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetIdentity
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetNetworkInterface
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetOsDisk
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetPlan
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetRollingUpgradePolicy
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetScaleIn
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetSecret
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetSourceImageReference
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetSpotRestore
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetTerminateNotification
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetTerminationNotification
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetWinrmListener
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Double
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetAdditionalCapabilities.Companion.toKotlin as windowsVirtualMachineScaleSetAdditionalCapabilitiesToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetAdditionalUnattendContent.Companion.toKotlin as windowsVirtualMachineScaleSetAdditionalUnattendContentToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetAutomaticInstanceRepair.Companion.toKotlin as windowsVirtualMachineScaleSetAutomaticInstanceRepairToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetAutomaticOsUpgradePolicy.Companion.toKotlin as windowsVirtualMachineScaleSetAutomaticOsUpgradePolicyToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetBootDiagnostics.Companion.toKotlin as windowsVirtualMachineScaleSetBootDiagnosticsToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetDataDisk.Companion.toKotlin as windowsVirtualMachineScaleSetDataDiskToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetExtension.Companion.toKotlin as windowsVirtualMachineScaleSetExtensionToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetGalleryApplication.Companion.toKotlin as windowsVirtualMachineScaleSetGalleryApplicationToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetIdentity.Companion.toKotlin as windowsVirtualMachineScaleSetIdentityToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetNetworkInterface.Companion.toKotlin as windowsVirtualMachineScaleSetNetworkInterfaceToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetOsDisk.Companion.toKotlin as windowsVirtualMachineScaleSetOsDiskToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetPlan.Companion.toKotlin as windowsVirtualMachineScaleSetPlanToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetRollingUpgradePolicy.Companion.toKotlin as windowsVirtualMachineScaleSetRollingUpgradePolicyToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetScaleIn.Companion.toKotlin as windowsVirtualMachineScaleSetScaleInToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetSecret.Companion.toKotlin as windowsVirtualMachineScaleSetSecretToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetSourceImageReference.Companion.toKotlin as windowsVirtualMachineScaleSetSourceImageReferenceToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetSpotRestore.Companion.toKotlin as windowsVirtualMachineScaleSetSpotRestoreToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetTerminateNotification.Companion.toKotlin as windowsVirtualMachineScaleSetTerminateNotificationToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetTerminationNotification.Companion.toKotlin as windowsVirtualMachineScaleSetTerminationNotificationToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineScaleSetWinrmListener.Companion.toKotlin as windowsVirtualMachineScaleSetWinrmListenerToKotlin

/**
 * Builder for [WindowsVirtualMachineScaleSet].
 */
@PulumiTagMarker
public class WindowsVirtualMachineScaleSetResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: WindowsVirtualMachineScaleSetArgs = WindowsVirtualMachineScaleSetArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend WindowsVirtualMachineScaleSetArgsBuilder.() -> Unit) {
        val builder = WindowsVirtualMachineScaleSetArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): WindowsVirtualMachineScaleSet {
        val builtJavaResource =
            com.pulumi.azure.compute.WindowsVirtualMachineScaleSet(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return WindowsVirtualMachineScaleSet(builtJavaResource)
    }
}

/**
 * Manages a Windows Virtual Machine Scale Set.
 * ## Disclaimers
 * > **Note:** 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.
 * > **Note:** All arguments including the administrator login and password will be stored in the raw state as plain-text. [Read more about sensitive data in state](https://www.terraform.io/docs/state/sensitive-data.html).
 * > **Note:** This provider will automatically update & reimage the nodes in the Scale Set (if Required) during an Update - this behaviour can be configured using the `features` setting within the Provider block.
 * > **Note:** This resource does not support Unmanaged Disks. If you need to use Unmanaged Disks you can continue to use the `azure.compute.ScaleSet` resource instead
 * ## Example Usage
 * This example provisions a basic Windows Virtual Machine Scale Set on an internal network.
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * 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 exampleWindowsVirtualMachineScaleSet = new azure.compute.WindowsVirtualMachineScaleSet("example", {
 *     name: "example-vmss",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: "Standard_F2",
 *     instances: 1,
 *     adminPassword: "P@55w0rd1234!",
 *     adminUsername: "adminuser",
 *     computerNamePrefix: "vm-",
 *     sourceImageReference: {
 *         publisher: "MicrosoftWindowsServer",
 *         offer: "WindowsServer",
 *         sku: "2016-Datacenter-Server-Core",
 *         version: "latest",
 *     },
 *     osDisk: {
 *         storageAccountType: "Standard_LRS",
 *         caching: "ReadWrite",
 *     },
 *     networkInterfaces: [{
 *         name: "example",
 *         primary: true,
 *         ipConfigurations: [{
 *             name: "internal",
 *             primary: true,
 *             subnetId: internal.id,
 *         }],
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * 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_windows_virtual_machine_scale_set = azure.compute.WindowsVirtualMachineScaleSet("example",
 *     name="example-vmss",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku="Standard_F2",
 *     instances=1,
 *     admin_password="P@55w0rd1234!",
 *     admin_username="adminuser",
 *     computer_name_prefix="vm-",
 *     source_image_reference={
 *         "publisher": "MicrosoftWindowsServer",
 *         "offer": "WindowsServer",
 *         "sku": "2016-Datacenter-Server-Core",
 *         "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,
 *         }],
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     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 exampleWindowsVirtualMachineScaleSet = new Azure.Compute.WindowsVirtualMachineScaleSet("example", new()
 *     {
 *         Name = "example-vmss",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Sku = "Standard_F2",
 *         Instances = 1,
 *         AdminPassword = "P@55w0rd1234!",
 *         AdminUsername = "adminuser",
 *         ComputerNamePrefix = "vm-",
 *         SourceImageReference = new Azure.Compute.Inputs.WindowsVirtualMachineScaleSetSourceImageReferenceArgs
 *         {
 *             Publisher = "MicrosoftWindowsServer",
 *             Offer = "WindowsServer",
 *             Sku = "2016-Datacenter-Server-Core",
 *             Version = "latest",
 *         },
 *         OsDisk = new Azure.Compute.Inputs.WindowsVirtualMachineScaleSetOsDiskArgs
 *         {
 *             StorageAccountType = "Standard_LRS",
 *             Caching = "ReadWrite",
 *         },
 *         NetworkInterfaces = new[]
 *         {
 *             new Azure.Compute.Inputs.WindowsVirtualMachineScaleSetNetworkInterfaceArgs
 *             {
 *                 Name = "example",
 *                 Primary = true,
 *                 IpConfigurations = new[]
 *                 {
 *                     new Azure.Compute.Inputs.WindowsVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs
 *                     {
 *                         Name = "internal",
 *                         Primary = true,
 *                         SubnetId = @internal.Id,
 *                     },
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		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.NewWindowsVirtualMachineScaleSet(ctx, "example", &compute.WindowsVirtualMachineScaleSetArgs{
 * 			Name:               pulumi.String("example-vmss"),
 * 			ResourceGroupName:  example.Name,
 * 			Location:           example.Location,
 * 			Sku:                pulumi.String("Standard_F2"),
 * 			Instances:          pulumi.Int(1),
 * 			AdminPassword:      pulumi.String("P@55w0rd1234!"),
 * 			AdminUsername:      pulumi.String("adminuser"),
 * 			ComputerNamePrefix: pulumi.String("vm-"),
 * 			SourceImageReference: &compute.WindowsVirtualMachineScaleSetSourceImageReferenceArgs{
 * 				Publisher: pulumi.String("MicrosoftWindowsServer"),
 * 				Offer:     pulumi.String("WindowsServer"),
 * 				Sku:       pulumi.String("2016-Datacenter-Server-Core"),
 * 				Version:   pulumi.String("latest"),
 * 			},
 * 			OsDisk: &compute.WindowsVirtualMachineScaleSetOsDiskArgs{
 * 				StorageAccountType: pulumi.String("Standard_LRS"),
 * 				Caching:            pulumi.String("ReadWrite"),
 * 			},
 * 			NetworkInterfaces: compute.WindowsVirtualMachineScaleSetNetworkInterfaceArray{
 * 				&compute.WindowsVirtualMachineScaleSetNetworkInterfaceArgs{
 * 					Name:    pulumi.String("example"),
 * 					Primary: pulumi.Bool(true),
 * 					IpConfigurations: compute.WindowsVirtualMachineScaleSetNetworkInterfaceIpConfigurationArray{
 * 						&compute.WindowsVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs{
 * 							Name:     pulumi.String("internal"),
 * 							Primary:  pulumi.Bool(true),
 * 							SubnetId: internal.ID(),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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.WindowsVirtualMachineScaleSet;
 * import com.pulumi.azure.compute.WindowsVirtualMachineScaleSetArgs;
 * import com.pulumi.azure.compute.inputs.WindowsVirtualMachineScaleSetSourceImageReferenceArgs;
 * import com.pulumi.azure.compute.inputs.WindowsVirtualMachineScaleSetOsDiskArgs;
 * import com.pulumi.azure.compute.inputs.WindowsVirtualMachineScaleSetNetworkInterfaceArgs;
 * 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 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 exampleWindowsVirtualMachineScaleSet = new WindowsVirtualMachineScaleSet("exampleWindowsVirtualMachineScaleSet", WindowsVirtualMachineScaleSetArgs.builder()
 *             .name("example-vmss")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku("Standard_F2")
 *             .instances(1)
 *             .adminPassword("P@55w0rd1234!")
 *             .adminUsername("adminuser")
 *             .computerNamePrefix("vm-")
 *             .sourceImageReference(WindowsVirtualMachineScaleSetSourceImageReferenceArgs.builder()
 *                 .publisher("MicrosoftWindowsServer")
 *                 .offer("WindowsServer")
 *                 .sku("2016-Datacenter-Server-Core")
 *                 .version("latest")
 *                 .build())
 *             .osDisk(WindowsVirtualMachineScaleSetOsDiskArgs.builder()
 *                 .storageAccountType("Standard_LRS")
 *                 .caching("ReadWrite")
 *                 .build())
 *             .networkInterfaces(WindowsVirtualMachineScaleSetNetworkInterfaceArgs.builder()
 *                 .name("example")
 *                 .primary(true)
 *                 .ipConfigurations(WindowsVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs.builder()
 *                     .name("internal")
 *                     .primary(true)
 *                     .subnetId(internal.id())
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * 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
 *   exampleWindowsVirtualMachineScaleSet:
 *     type: azure:compute:WindowsVirtualMachineScaleSet
 *     name: example
 *     properties:
 *       name: example-vmss
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sku: Standard_F2
 *       instances: 1
 *       adminPassword: P@55w0rd1234!
 *       adminUsername: adminuser
 *       computerNamePrefix: vm-
 *       sourceImageReference:
 *         publisher: MicrosoftWindowsServer
 *         offer: WindowsServer
 *         sku: 2016-Datacenter-Server-Core
 *         version: latest
 *       osDisk:
 *         storageAccountType: Standard_LRS
 *         caching: ReadWrite
 *       networkInterfaces:
 *         - name: example
 *           primary: true
 *           ipConfigurations:
 *             - name: internal
 *               primary: true
 *               subnetId: ${internal.id}
 * ```
 * 
 * ## Import
 * Windows Virtual Machine Scale Sets can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:compute/windowsVirtualMachineScaleSet:WindowsVirtualMachineScaleSet example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachineScaleSets/scaleset1
 * ```
 */
public class WindowsVirtualMachineScaleSet internal constructor(
    override val javaResource: com.pulumi.azure.compute.WindowsVirtualMachineScaleSet,
) : KotlinCustomResource(javaResource, WindowsVirtualMachineScaleSetMapper) {
    /**
     * An `additional_capabilities` block as defined below.
     */
    public val additionalCapabilities: Output?
        get() = javaResource.additionalCapabilities().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachineScaleSetAdditionalCapabilitiesToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * One or more `additional_unattend_content` blocks as defined below. Changing this forces a new resource to be created.
     */
    public val additionalUnattendContents:
        Output>?
        get() = javaResource.additionalUnattendContents().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        windowsVirtualMachineScaleSetAdditionalUnattendContentToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The Password which should be used for the local-administrator on this Virtual Machine. Changing this forces a new resource to be created.
     */
    public val adminPassword: Output
        get() = javaResource.adminPassword().applyValue({ args0 -> args0 })

    /**
     * The username of the local administrator on each Virtual Machine Scale Set instance. Changing this forces a new resource to be created.
     */
    public val adminUsername: Output
        get() = javaResource.adminUsername().applyValue({ args0 -> args0 })

    /**
     * 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](https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-health-extension).
     * > **Note:** For more information about Automatic Instance Repair, please refer to [this doc](https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-automatic-instance-repairs).
     */
    public val automaticInstanceRepair: Output
        get() = javaResource.automaticInstanceRepair().applyValue({ args0 ->
            args0.let({ args0 ->
                windowsVirtualMachineScaleSetAutomaticInstanceRepairToKotlin(args0)
            })
        })

    /**
     * An `automatic_os_upgrade_policy` block as defined below. This can only be specified when `upgrade_mode` is set to either `Automatic` or `Rolling`.
     */
    public val automaticOsUpgradePolicy:
        Output?
        get() = javaResource.automaticOsUpgradePolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachineScaleSetAutomaticOsUpgradePolicyToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A `boot_diagnostics` block as defined below.
     */
    public val bootDiagnostics: Output?
        get() = javaResource.bootDiagnostics().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachineScaleSetBootDiagnosticsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * 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.
     * > **Note:** `capacity_reservation_group_id` cannot be used with `proximity_placement_group_id`
     * > **Note:** `single_placement_group` must be set to `false` when `capacity_reservation_group_id` is specified.
     */
    public val capacityReservationGroupId: Output?
        get() = javaResource.capacityReservationGroupId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val computerNamePrefix: Output
        get() = javaResource.computerNamePrefix().applyValue({ args0 -> args0 })

    /**
     * The Base64-Encoded Custom Data which should be used for this Virtual Machine Scale Set.
     * > **Note:** When Custom Data has been configured, it's not possible to remove it without tainting the Virtual Machine Scale Set, due to a limitation of the Azure API.
     */
    public val customData: Output?
        get() = javaResource.customData().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * One or more `data_disk` blocks as defined below.
     */
    public val dataDisks: Output>?
        get() = javaResource.dataDisks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        windowsVirtualMachineScaleSetDataDiskToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Should Virtual Machine Extensions be run on Overprovisioned Virtual Machines in the Scale Set? Defaults to `false`.
     */
    public val doNotRunExtensionsOnOverprovisionedMachines: Output?
        get() = javaResource.doNotRunExtensionsOnOverprovisionedMachines().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * Specifies the Edge Zone within the Azure Region where this Windows Virtual Machine Scale Set should exist. Changing this forces a new Windows Virtual Machine Scale Set to be created.
     */
    public val edgeZone: Output?
        get() = javaResource.edgeZone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Are automatic updates enabled for this Virtual Machine? Defaults to `true`.
     */
    public val enableAutomaticUpdates: Output?
        get() = javaResource.enableAutomaticUpdates().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Should all of the disks (including the temp disk) attached to this Virtual Machine be encrypted by enabling Encryption at Host?
     */
    public val encryptionAtHostEnabled: Output?
        get() = javaResource.encryptionAtHostEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(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.
     * > **Note:** This can only be configured when `priority` is set to `Spot`.
     */
    public val evictionPolicy: Output?
        get() = javaResource.evictionPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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 Windows Virtual Machine Scale Set to be created.
     * > **Note:** `extension_operations_enabled` may only be set to `false` if there are no extensions defined in the `extension` field.
     */
    public val extensionOperationsEnabled: Output
        get() = javaResource.extensionOperationsEnabled().applyValue({ args0 -> args0 })

    /**
     * One or more `extension` blocks as defined below
     */
    public val extensions: Output>
        get() = javaResource.extensions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachineScaleSetExtensionToKotlin(args0)
                })
            })
        })

    /**
     * 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`.
     */
    public val extensionsTimeBudget: Output?
        get() = javaResource.extensionsTimeBudget().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * One or more `gallery_application` blocks as defined below.
     */
    public val galleryApplication: Output>
        get() = javaResource.galleryApplication().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> windowsVirtualMachineScaleSetGalleryApplicationToKotlin(args0) })
            })
        })

    @Deprecated(
        message = """
  `gallery_applications` has been renamed to `gallery_application` and will be deprecated in 4.0
  """,
    )
    public val galleryApplications: Output>
        get() = javaResource.galleryApplications().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> windowsVirtualMachineScaleSetGalleryApplicationToKotlin(args0) })
            })
        })

    /**
     * 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`.
     */
    public val healthProbeId: Output?
        get() = javaResource.healthProbeId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val hostGroupId: Output?
        get() = javaResource.hostGroupId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachineScaleSetIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The number of Virtual Machines in the Scale Set.
     * > **NOTE:** If you're using AutoScaling, you may wish to use [`Ignore Changes` functionality](https://www.pulumi.com/docs/intro/concepts/programming-model/#ignorechanges) to ignore changes to this field.
     */
    public val instances: Output
        get() = javaResource.instances().applyValue({ args0 -> args0 })

    /**
     * Specifies the type of on-premise license (also known as [Azure Hybrid Use Benefit](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing)) which should be used for this Virtual Machine Scale Set. Possible values are `None`, `Windows_Client` and `Windows_Server`.
     */
    public val licenseType: Output?
        get() = javaResource.licenseType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Azure location where the Windows Virtual Machine Scale Set should exist. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * 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 the Scale Set should not be evicted for price reasons.
     * > **Note:** This can only be configured when `priority` is set to `Spot`.
     */
    public val maxBidPrice: Output?
        get() = javaResource.maxBidPrice().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Windows Virtual Machine Scale Set. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * One or more `network_interface` blocks as defined below.
     */
    public val networkInterfaces: Output>
        get() = javaResource.networkInterfaces().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> windowsVirtualMachineScaleSetNetworkInterfaceToKotlin(args0) })
            })
        })

    /**
     * An `os_disk` block as defined below.
     */
    public val osDisk: Output
        get() = javaResource.osDisk().applyValue({ args0 ->
            args0.let({ args0 ->
                windowsVirtualMachineScaleSetOsDiskToKotlin(args0)
            })
        })

    /**
     * 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`.
     */
    public val overprovision: Output?
        get() = javaResource.overprovision().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `plan` block as defined below. Changing this forces a new resource to be created.
     * > **Note:** When using an image from Azure Marketplace a `plan` must be specified.
     */
    public val plan: Output?
        get() = javaResource.plan().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachineScaleSetPlanToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val platformFaultDomainCount: Output
        get() = javaResource.platformFaultDomainCount().applyValue({ args0 -> args0 })

    /**
     * The Priority of this Virtual Machine Scale Set. Possible values are `Regular` and `Spot`. Defaults to `Regular`. Changing this value forces a new resource.
     * > **Note:** When `priority` is set to `Spot` an `eviction_policy` must be specified.
     */
    public val priority: Output?
        get() = javaResource.priority().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * 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.
     */
    public val provisionVmAgent: Output?
        get() = javaResource.provisionVmAgent().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val proximityPlacementGroupId: Output?
        get() = javaResource.proximityPlacementGroupId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Resource Group in which the Windows Virtual Machine Scale Set should be exist. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * 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.
     */
    public val rollingUpgradePolicy: Output?
        get() = javaResource.rollingUpgradePolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachineScaleSetRollingUpgradePolicyToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A `scale_in` block as defined below.
     */
    public val scaleIn: Output
        get() = javaResource.scaleIn().applyValue({ args0 ->
            args0.let({ args0 ->
                windowsVirtualMachineScaleSetScaleInToKotlin(args0)
            })
        })

    @Deprecated(
        message = """
  `scale_in_policy` will be removed in favour of the `scale_in` code block in version 4.0 of the
      AzureRM Provider.
  """,
    )
    public val scaleInPolicy: Output
        get() = javaResource.scaleInPolicy().applyValue({ args0 -> args0 })

    /**
     * One or more `secret` blocks as defined below.
     */
    public val secrets: Output>?
        get() = javaResource.secrets().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> windowsVirtualMachineScaleSetSecretToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Specifies if Secure Boot and Trusted Launch is enabled for the Virtual Machine. Changing this forces a new resource to be created.
     */
    public val secureBootEnabled: Output?
        get() = javaResource.secureBootEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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`.
     */
    public val singlePlacementGroup: Output?
        get() = javaResource.singlePlacementGroup().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Virtual Machine SKU for the Scale Set, such as `Standard_F2`.
     */
    public val sku: Output
        get() = javaResource.sku().applyValue({ args0 -> args0 })

    /**
     * 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`.
     * > **Note:** One of either `source_image_id` or `source_image_reference` must be set.
     */
    public val sourceImageId: Output?
        get() = javaResource.sourceImageId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `source_image_reference` block as defined below.
     * > **Note:** One of either `source_image_id` or `source_image_reference` must be set.
     */
    public val sourceImageReference: Output?
        get() = javaResource.sourceImageReference().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachineScaleSetSourceImageReferenceToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A `spot_restore` block as defined below.
     */
    public val spotRestore: Output
        get() = javaResource.spotRestore().applyValue({ args0 ->
            args0.let({ args0 ->
                windowsVirtualMachineScaleSetSpotRestoreToKotlin(args0)
            })
        })

    /**
     * A mapping of tags which should be assigned to this Virtual Machine Scale Set.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A `terminate_notification` block as defined below.
     * > **Note:** This property has been deprecated in favour of the `termination_notification` property and will be removed in version 4.0 of the provider.
     */
    @Deprecated(
        message = """
  `terminate_notification` has been renamed to `termination_notification` and will be removed in
      4.0.
  """,
    )
    public val terminateNotification: Output
        get() = javaResource.terminateNotification().applyValue({ args0 ->
            args0.let({ args0 ->
                windowsVirtualMachineScaleSetTerminateNotificationToKotlin(args0)
            })
        })

    /**
     * A `termination_notification` block as defined below.
     */
    public val terminationNotification: Output
        get() = javaResource.terminationNotification().applyValue({ args0 ->
            args0.let({ args0 ->
                windowsVirtualMachineScaleSetTerminationNotificationToKotlin(args0)
            })
        })

    /**
     * Specifies the time zone of the virtual machine, [the possible values are defined here](https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/).
     */
    public val timezone: Output?
        get() = javaResource.timezone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The Unique ID for this Windows Virtual Machine Scale Set.
     */
    public val uniqueId: Output
        get() = javaResource.uniqueId().applyValue({ args0 -> args0 })

    public val upgradeMode: Output?
        get() = javaResource.upgradeMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Base64-Encoded User Data which should be used for this Virtual Machine Scale Set.
     */
    public val userData: Output?
        get() = javaResource.userData().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies if vTPM (Virtual Trusted Platform Module) and Trusted Launch is enabled for the Virtual Machine. Changing this forces a new resource to be created.
     */
    public val vtpmEnabled: Output?
        get() = javaResource.vtpmEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * One or more `winrm_listener` blocks as defined below. Changing this forces a new resource to be created.
     */
    public val winrmListeners: Output>?
        get() = javaResource.winrmListeners().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        windowsVirtualMachineScaleSetWinrmListenerToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * 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.
     * > **Note:** This can only be set to `true` when one or more `zones` are configured.
     */
    public val zoneBalance: Output?
        get() = javaResource.zoneBalance().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies a list of Availability Zones in which this Windows Virtual Machine Scale Set should be located. Changing this forces a new Windows Virtual Machine Scale Set to be created.
     */
    public val zones: Output>?
        get() = javaResource.zones().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })
}

public object WindowsVirtualMachineScaleSetMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.compute.WindowsVirtualMachineScaleSet::class == javaResource::class

    override fun map(javaResource: Resource): WindowsVirtualMachineScaleSet =
        WindowsVirtualMachineScaleSet(
            javaResource as
                com.pulumi.azure.compute.WindowsVirtualMachineScaleSet,
        )
}

/**
 * @see [WindowsVirtualMachineScaleSet].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [WindowsVirtualMachineScaleSet].
 */
public suspend fun windowsVirtualMachineScaleSet(
    name: String,
    block: suspend WindowsVirtualMachineScaleSetResourceBuilder.() -> Unit,
): WindowsVirtualMachineScaleSet {
    val builder = WindowsVirtualMachineScaleSetResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [WindowsVirtualMachineScaleSet].
 * @param name The _unique_ name of the resulting resource.
 */
public fun windowsVirtualMachineScaleSet(name: String): WindowsVirtualMachineScaleSet {
    val builder = WindowsVirtualMachineScaleSetResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy