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

com.pulumi.azure.compute.kotlin.WindowsVirtualMachine.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.WindowsVirtualMachineAdditionalCapabilities
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineAdditionalUnattendContent
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineBootDiagnostics
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineGalleryApplication
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineIdentity
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineOsDisk
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineOsImageNotification
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachinePlan
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineSecret
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineSourceImageReference
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineTerminationNotification
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineWinrmListener
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.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.WindowsVirtualMachineAdditionalCapabilities.Companion.toKotlin as windowsVirtualMachineAdditionalCapabilitiesToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineAdditionalUnattendContent.Companion.toKotlin as windowsVirtualMachineAdditionalUnattendContentToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineBootDiagnostics.Companion.toKotlin as windowsVirtualMachineBootDiagnosticsToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineGalleryApplication.Companion.toKotlin as windowsVirtualMachineGalleryApplicationToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineIdentity.Companion.toKotlin as windowsVirtualMachineIdentityToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineOsDisk.Companion.toKotlin as windowsVirtualMachineOsDiskToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineOsImageNotification.Companion.toKotlin as windowsVirtualMachineOsImageNotificationToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachinePlan.Companion.toKotlin as windowsVirtualMachinePlanToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineSecret.Companion.toKotlin as windowsVirtualMachineSecretToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineSourceImageReference.Companion.toKotlin as windowsVirtualMachineSourceImageReferenceToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineTerminationNotification.Companion.toKotlin as windowsVirtualMachineTerminationNotificationToKotlin
import com.pulumi.azure.compute.kotlin.outputs.WindowsVirtualMachineWinrmListener.Companion.toKotlin as windowsVirtualMachineWinrmListenerToKotlin

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

    public var args: WindowsVirtualMachineArgs = WindowsVirtualMachineArgs()

    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 WindowsVirtualMachineArgsBuilder.() -> Unit) {
        val builder = WindowsVirtualMachineArgsBuilder()
        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(): WindowsVirtualMachine {
        val builtJavaResource = com.pulumi.azure.compute.WindowsVirtualMachine(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return WindowsVirtualMachine(builtJavaResource)
    }
}

/**
 * Manages a Windows Virtual Machine.
 * ## Disclaimers
 * > **Note** This provider will automatically remove the OS Disk by default - this behaviour can be configured using the `features` setting within the Provider block.
 * > **Note** All arguments including the administrator login and password will be stored in the raw state as plain-text.
 * > **Note** This resource does not support Unmanaged Disks. If you need to use Unmanaged Disks you can continue to use the `azure.compute.VirtualMachine` resource instead.
 * > **Note** This resource does not support attaching existing OS Disks. You can instead capture an image of the OS Disk or continue to use the `azure.compute.VirtualMachine` resource instead.
 * > In this release there's a known issue where the `public_ip_address` and `public_ip_addresses` fields may not be fully populated for Dynamic Public IP's.
 * ## Example Usage
 * This example provisions a basic Windows Virtual Machine 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",
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "internal",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 * });
 * const exampleNetworkInterface = new azure.network.NetworkInterface("example", {
 *     name: "example-nic",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     ipConfigurations: [{
 *         name: "internal",
 *         subnetId: exampleSubnet.id,
 *         privateIpAddressAllocation: "Dynamic",
 *     }],
 * });
 * const exampleWindowsVirtualMachine = new azure.compute.WindowsVirtualMachine("example", {
 *     name: "example-machine",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     size: "Standard_F2",
 *     adminUsername: "adminuser",
 *     adminPassword: "P@$$w0rd1234!",
 *     networkInterfaceIds: [exampleNetworkInterface.id],
 *     osDisk: {
 *         caching: "ReadWrite",
 *         storageAccountType: "Standard_LRS",
 *     },
 *     sourceImageReference: {
 *         publisher: "MicrosoftWindowsServer",
 *         offer: "WindowsServer",
 *         sku: "2016-Datacenter",
 *         version: "latest",
 *     },
 * });
 * ```
 * ```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",
 *     address_spaces=["10.0.0.0/16"],
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_subnet = azure.network.Subnet("example",
 *     name="internal",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_virtual_network.name,
 *     address_prefixes=["10.0.2.0/24"])
 * example_network_interface = azure.network.NetworkInterface("example",
 *     name="example-nic",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     ip_configurations=[azure.network.NetworkInterfaceIpConfigurationArgs(
 *         name="internal",
 *         subnet_id=example_subnet.id,
 *         private_ip_address_allocation="Dynamic",
 *     )])
 * example_windows_virtual_machine = azure.compute.WindowsVirtualMachine("example",
 *     name="example-machine",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     size="Standard_F2",
 *     admin_username="adminuser",
 *     admin_password="P@$$w0rd1234!",
 *     network_interface_ids=[example_network_interface.id],
 *     os_disk=azure.compute.WindowsVirtualMachineOsDiskArgs(
 *         caching="ReadWrite",
 *         storage_account_type="Standard_LRS",
 *     ),
 *     source_image_reference=azure.compute.WindowsVirtualMachineSourceImageReferenceArgs(
 *         publisher="MicrosoftWindowsServer",
 *         offer="WindowsServer",
 *         sku="2016-Datacenter",
 *         version="latest",
 *     ))
 * ```
 * ```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",
 *         AddressSpaces = new[]
 *         {
 *             "10.0.0.0/16",
 *         },
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleSubnet = new Azure.Network.Subnet("example", new()
 *     {
 *         Name = "internal",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = exampleVirtualNetwork.Name,
 *         AddressPrefixes = new[]
 *         {
 *             "10.0.2.0/24",
 *         },
 *     });
 *     var exampleNetworkInterface = new Azure.Network.NetworkInterface("example", new()
 *     {
 *         Name = "example-nic",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         IpConfigurations = new[]
 *         {
 *             new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
 *             {
 *                 Name = "internal",
 *                 SubnetId = exampleSubnet.Id,
 *                 PrivateIpAddressAllocation = "Dynamic",
 *             },
 *         },
 *     });
 *     var exampleWindowsVirtualMachine = new Azure.Compute.WindowsVirtualMachine("example", new()
 *     {
 *         Name = "example-machine",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Size = "Standard_F2",
 *         AdminUsername = "adminuser",
 *         AdminPassword = "P@$$w0rd1234!",
 *         NetworkInterfaceIds = new[]
 *         {
 *             exampleNetworkInterface.Id,
 *         },
 *         OsDisk = new Azure.Compute.Inputs.WindowsVirtualMachineOsDiskArgs
 *         {
 *             Caching = "ReadWrite",
 *             StorageAccountType = "Standard_LRS",
 *         },
 *         SourceImageReference = new Azure.Compute.Inputs.WindowsVirtualMachineSourceImageReferenceArgs
 *         {
 *             Publisher = "MicrosoftWindowsServer",
 *             Offer = "WindowsServer",
 *             Sku = "2016-Datacenter",
 *             Version = "latest",
 *         },
 *     });
 * });
 * ```
 * ```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"),
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.0.0/16"),
 * 			},
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnet, err := network.NewSubnet(ctx, "example", &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
 * 		}
 * 		exampleNetworkInterface, err := network.NewNetworkInterface(ctx, "example", &network.NetworkInterfaceArgs{
 * 			Name:              pulumi.String("example-nic"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			IpConfigurations: network.NetworkInterfaceIpConfigurationArray{
 * 				&network.NetworkInterfaceIpConfigurationArgs{
 * 					Name:                       pulumi.String("internal"),
 * 					SubnetId:                   exampleSubnet.ID(),
 * 					PrivateIpAddressAllocation: pulumi.String("Dynamic"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewWindowsVirtualMachine(ctx, "example", &compute.WindowsVirtualMachineArgs{
 * 			Name:              pulumi.String("example-machine"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Size:              pulumi.String("Standard_F2"),
 * 			AdminUsername:     pulumi.String("adminuser"),
 * 			AdminPassword:     pulumi.String("P@$$w0rd1234!"),
 * 			NetworkInterfaceIds: pulumi.StringArray{
 * 				exampleNetworkInterface.ID(),
 * 			},
 * 			OsDisk: &compute.WindowsVirtualMachineOsDiskArgs{
 * 				Caching:            pulumi.String("ReadWrite"),
 * 				StorageAccountType: pulumi.String("Standard_LRS"),
 * 			},
 * 			SourceImageReference: &compute.WindowsVirtualMachineSourceImageReferenceArgs{
 * 				Publisher: pulumi.String("MicrosoftWindowsServer"),
 * 				Offer:     pulumi.String("WindowsServer"),
 * 				Sku:       pulumi.String("2016-Datacenter"),
 * 				Version:   pulumi.String("latest"),
 * 			},
 * 		})
 * 		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.network.NetworkInterface;
 * import com.pulumi.azure.network.NetworkInterfaceArgs;
 * import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
 * import com.pulumi.azure.compute.WindowsVirtualMachine;
 * import com.pulumi.azure.compute.WindowsVirtualMachineArgs;
 * import com.pulumi.azure.compute.inputs.WindowsVirtualMachineOsDiskArgs;
 * import com.pulumi.azure.compute.inputs.WindowsVirtualMachineSourceImageReferenceArgs;
 * 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")
 *             .addressSpaces("10.0.0.0/16")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("internal")
 *             .resourceGroupName(example.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes("10.0.2.0/24")
 *             .build());
 *         var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
 *             .name("example-nic")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
 *                 .name("internal")
 *                 .subnetId(exampleSubnet.id())
 *                 .privateIpAddressAllocation("Dynamic")
 *                 .build())
 *             .build());
 *         var exampleWindowsVirtualMachine = new WindowsVirtualMachine("exampleWindowsVirtualMachine", WindowsVirtualMachineArgs.builder()
 *             .name("example-machine")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .size("Standard_F2")
 *             .adminUsername("adminuser")
 *             .adminPassword("P@$$w0rd1234!")
 *             .networkInterfaceIds(exampleNetworkInterface.id())
 *             .osDisk(WindowsVirtualMachineOsDiskArgs.builder()
 *                 .caching("ReadWrite")
 *                 .storageAccountType("Standard_LRS")
 *                 .build())
 *             .sourceImageReference(WindowsVirtualMachineSourceImageReferenceArgs.builder()
 *                 .publisher("MicrosoftWindowsServer")
 *                 .offer("WindowsServer")
 *                 .sku("2016-Datacenter")
 *                 .version("latest")
 *                 .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
 *       addressSpaces:
 *         - 10.0.0.0/16
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleSubnet:
 *     type: azure:network:Subnet
 *     name: example
 *     properties:
 *       name: internal
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${exampleVirtualNetwork.name}
 *       addressPrefixes:
 *         - 10.0.2.0/24
 *   exampleNetworkInterface:
 *     type: azure:network:NetworkInterface
 *     name: example
 *     properties:
 *       name: example-nic
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       ipConfigurations:
 *         - name: internal
 *           subnetId: ${exampleSubnet.id}
 *           privateIpAddressAllocation: Dynamic
 *   exampleWindowsVirtualMachine:
 *     type: azure:compute:WindowsVirtualMachine
 *     name: example
 *     properties:
 *       name: example-machine
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       size: Standard_F2
 *       adminUsername: adminuser
 *       adminPassword: P@$$w0rd1234!
 *       networkInterfaceIds:
 *         - ${exampleNetworkInterface.id}
 *       osDisk:
 *         caching: ReadWrite
 *         storageAccountType: Standard_LRS
 *       sourceImageReference:
 *         publisher: MicrosoftWindowsServer
 *         offer: WindowsServer
 *         sku: 2016-Datacenter
 *         version: latest
 * ```
 * 
 * ## Import
 * Windows Virtual Machines can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:compute/windowsVirtualMachine:WindowsVirtualMachine example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/machine1
 * ```
 */
public class WindowsVirtualMachine internal constructor(
    override val javaResource: com.pulumi.azure.compute.WindowsVirtualMachine,
) : KotlinCustomResource(javaResource, WindowsVirtualMachineMapper) {
    /**
     * A `additional_capabilities` block as defined below.
     */
    public val additionalCapabilities: Output?
        get() = javaResource.additionalCapabilities().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachineAdditionalCapabilitiesToKotlin(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 ->
                        windowsVirtualMachineAdditionalUnattendContentToKotlin(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 used for the Virtual Machine. Changing this forces a new resource to be created.
     */
    public val adminUsername: Output
        get() = javaResource.adminUsername().applyValue({ args0 -> args0 })

    /**
     * Should Extension Operations be allowed on this Virtual Machine? Defaults to `true`.
     */
    public val allowExtensionOperations: Output?
        get() = javaResource.allowExtensionOperations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the ID of the Availability Set in which the Virtual Machine should exist. Changing this forces a new resource to be created.
     */
    public val availabilitySetId: Output?
        get() = javaResource.availabilitySetId().applyValue({ args0 ->
            args0.map({ args0 ->
                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 -> windowsVirtualMachineBootDiagnosticsToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Specifies whether to skip platform scheduled patching when a user schedule is associated with the VM. Defaults to `false`.
     * > **NOTE:** `bypass_platform_safety_checks_on_user_schedule_enabled` can only be set to `true` when `patch_mode` is set to `AutomaticByPlatform`.
     */
    public val bypassPlatformSafetyChecksOnUserScheduleEnabled: Output?
        get() = javaResource.bypassPlatformSafetyChecksOnUserScheduleEnabled().applyValue({ args0 ->
            args0.map({ args0 -> args0 }).orElse(null)
        })

    /**
     * Specifies the ID of the Capacity Reservation Group which the Virtual Machine should be allocated to.
     * > **NOTE:** `capacity_reservation_group_id` cannot be used with `availability_set_id` or `proximity_placement_group_id`
     */
    public val capacityReservationGroupId: Output?
        get() = javaResource.capacityReservationGroupId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the Hostname which should be used for this Virtual Machine. If unspecified this defaults to the value for the `name` field. If the value of the `name` field is not a valid `computer_name`, then you must specify `computer_name`. Changing this forces a new resource to be created.
     */
    public val computerName: Output
        get() = javaResource.computerName().applyValue({ args0 -> args0 })

    /**
     * The Base64-Encoded Custom Data which should be used for this Virtual Machine. Changing this forces a new resource to be created.
     */
    public val customData: Output?
        get() = javaResource.customData().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of a Dedicated Host Group that this Windows Virtual Machine should be run within. Conflicts with `dedicated_host_id`.
     */
    public val dedicatedHostGroupId: Output?
        get() = javaResource.dedicatedHostGroupId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of a Dedicated Host where this machine should be run on. Conflicts with `dedicated_host_group_id`.
     */
    public val dedicatedHostId: Output?
        get() = javaResource.dedicatedHostId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the Disk Controller Type used for this Virtual Machine. Possible values are `SCSI` and `NVMe`.
     */
    public val diskControllerType: Output
        get() = javaResource.diskControllerType().applyValue({ args0 -> args0 })

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

    /**
     * Specifies if Automatic Updates are Enabled for the Windows Virtual Machine. Changing this forces a new resource to be created. 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 what should happen when the Virtual Machine is evicted for price reasons when using a Spot instance. 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)
        })

    /**
     * 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.
     * > **Note** Gallery Application Assignments can be defined either directly on `azure.compute.WindowsVirtualMachine` resource, or using the `azure.compute.GalleryApplicationAssignment` resource - but the two approaches cannot be used together. If both are used with the same Virtual Machine, spurious changes will occur. If `azure.compute.GalleryApplicationAssignment` is used, it's recommended to use `ignore_changes` for the `gallery_application` block on the corresponding `azure.compute.WindowsVirtualMachine` resource, to avoid a persistent diff when using this resource.
     */
    public val galleryApplications: Output>?
        get() = javaResource.galleryApplications().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        windowsVirtualMachineGalleryApplicationToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Should the VM be patched without requiring a reboot? Possible values are `true` or `false`. Defaults to `false`. For more information about hot patching please see the [product documentation](https://docs.microsoft.com/azure/automanage/automanage-hotpatch).
     * > **NOTE:** Hotpatching can only be enabled if the `patch_mode` is set to `AutomaticByPlatform`, the `provision_vm_agent` is set to `true`, your `source_image_reference` references a hotpatching enabled image, and the VM's `size` is set to a Azure generation 2 directory within the GitHub Repository.
     */
    public val hotpatchingEnabled: Output?
        get() = javaResource.hotpatchingEnabled().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 ->
                    windowsVirtualMachineIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies the type of on-premise license (also known as [Azure Hybrid Use Benefit](https://docs.microsoft.com/windows-server/get-started/azure-hybrid-benefit)) which should be used for this Virtual Machine. 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 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 this Virtual Machine, in US Dollars; which must be greater than the current spot price. If this bid price falls below the current spot price the Virtual Machine will be evicted using the `eviction_policy`. Defaults to `-1`, which means that the Virtual Machine 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. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * . A list of Network Interface IDs which should be attached to this Virtual Machine. The first Network Interface ID in this list will be the Primary Network Interface on the Virtual Machine.
     */
    public val networkInterfaceIds: Output>
        get() = javaResource.networkInterfaceIds().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

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

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

    /**
     * Specifies the mode of VM Guest Patching for the Virtual Machine. Possible values are `AutomaticByPlatform` or `ImageDefault`. Defaults to `ImageDefault`.
     * > **NOTE:** If the `patch_assessment_mode` is set to `AutomaticByPlatform` then the `provision_vm_agent` field must be set to `true`.
     */
    public val patchAssessmentMode: Output?
        get() = javaResource.patchAssessmentMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the mode of in-guest patching to this Windows Virtual Machine. Possible values are `Manual`, `AutomaticByOS` and `AutomaticByPlatform`. Defaults to `AutomaticByOS`. For more information on patch modes please see the [product documentation](https://docs.microsoft.com/azure/virtual-machines/automatic-vm-guest-patching#patch-orchestration-modes).
     * > **NOTE:** If `patch_mode` is set to `AutomaticByPlatform` then `provision_vm_agent` must also be set to `true`. If the Virtual Machine is using a hotpatching enabled image the `patch_mode` must always be set to `AutomaticByPlatform`.
     */
    public val patchMode: Output?
        get() = javaResource.patchMode().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A `plan` block as defined below. Changing this forces a new resource to be created.
     */
    public val plan: Output?
        get() = javaResource.plan().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    windowsVirtualMachinePlanToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies the Platform Fault Domain in which this Windows Virtual Machine should be created. Defaults to `-1`, which means this will be automatically assigned to a fault domain that best maintains balance across the available fault domains. Changing this forces a new Windows Virtual Machine to be created.
     */
    public val platformFaultDomain: Output?
        get() = javaResource.platformFaultDomain().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the priority of this Virtual Machine. Possible values are `Regular` and `Spot`. Defaults to `Regular`. Changing this forces a new resource to be created.
     */
    public val priority: Output?
        get() = javaResource.priority().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The Primary Private IP Address assigned to this Virtual Machine.
     */
    public val privateIpAddress: Output
        get() = javaResource.privateIpAddress().applyValue({ args0 -> args0 })

    /**
     * A list of Private IP Addresses assigned to this Virtual Machine.
     */
    public val privateIpAddresses: Output>
        get() = javaResource.privateIpAddresses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Should the Azure VM Agent be provisioned on this Virtual Machine? Defaults to `true`. Changing this forces a new resource to be created.
     * > **NOTE:** If `provision_vm_agent` is set to `false` then `allow_extension_operations` must also be set to `false`.
     */
    public val provisionVmAgent: Output?
        get() = javaResource.provisionVmAgent().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the Proximity Placement Group which the Virtual Machine should be assigned to.
     */
    public val proximityPlacementGroupId: Output?
        get() = javaResource.proximityPlacementGroupId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Primary Public IP Address assigned to this Virtual Machine.
     */
    public val publicIpAddress: Output
        get() = javaResource.publicIpAddress().applyValue({ args0 -> args0 })

    /**
     * A list of the Public IP Addresses assigned to this Virtual Machine.
     */
    public val publicIpAddresses: Output>
        get() = javaResource.publicIpAddresses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Specifies the reboot setting for platform scheduled patching. Possible values are `Always`, `IfRequired` and `Never`.
     * > **NOTE:** `reboot_setting` can only be set when `patch_mode` is set to `AutomaticByPlatform`.
     */
    public val rebootSetting: Output?
        get() = javaResource.rebootSetting().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Resource Group in which the Windows Virtual Machine should be exist. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().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 -> windowsVirtualMachineSecretToKotlin(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)
        })

    /**
     * The SKU which should be used for this Virtual Machine, such as `Standard_F2`.
     */
    public val size: Output
        get() = javaResource.size().applyValue({ args0 -> args0 })

    /**
     * The ID of the Image which this Virtual Machine should be created from. Changing this forces a new resource to be created. Possible Image ID types include `Image ID`s, `Shared Image ID`s, `Shared Image Version ID`s, `Community Gallery Image ID`s, `Community Gallery Image Version ID`s, `Shared Gallery Image ID`s and `Shared Gallery Image Version ID`s.
     * > **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. Changing this forces a new resource to be created.
     * > **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 ->
                    windowsVirtualMachineSourceImageReferenceToKotlin(args0)
                })
            }).orElse(null)
        })

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

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

    /**
     * Specifies the Time Zone which should be used by the Virtual Machine, [the possible values are defined here](https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/). Changing this forces a new resource to be created.
     */
    public val timezone: Output?
        get() = javaResource.timezone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

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

    /**
     * A 128-bit identifier which uniquely identifies this Virtual Machine.
     */
    public val virtualMachineId: Output
        get() = javaResource.virtualMachineId().applyValue({ args0 -> args0 })

    /**
     * Specifies the Orchestrated Virtual Machine Scale Set that this Virtual Machine should be created within.
     * > **NOTE:** To update `virtual_machine_scale_set_id` the Preview Feature `Microsoft.Compute/SingleFDAttachDetachVMToVmss` needs to be enabled, see [the documentation](https://review.learn.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-attach-detach-vm#enroll-in-the-preview) for more information.
     * > **NOTE:** Orchestrated Virtual Machine Scale Sets can be provisioned using [the `azure.compute.OrchestratedVirtualMachineScaleSet` resource](https://www.terraform.io/docs/providers/azurerm/r/orchestrated_virtual_machine_scale_set.html).
     */
    public val virtualMachineScaleSetId: Output?
        get() = javaResource.virtualMachineScaleSetId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies whether VMAgent Platform Updates is enabled. Defaults to `false`.
     */
    public val vmAgentPlatformUpdatesEnabled: Output?
        get() = javaResource.vmAgentPlatformUpdatesEnabled().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 ->
                        windowsVirtualMachineWinrmListenerToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

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

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy