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

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

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.compute.kotlin

import com.pulumi.azure.compute.ExtensionArgs.builder
import com.pulumi.azure.compute.kotlin.inputs.ExtensionProtectedSettingsFromKeyVaultArgs
import com.pulumi.azure.compute.kotlin.inputs.ExtensionProtectedSettingsFromKeyVaultArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Virtual Machine Extension to provide post deployment configuration
 * and run automated tasks.
 * > **NOTE:** Custom Script Extensions for Linux & Windows require that the `commandToExecute` returns a `0` exit code to be classified as successfully deployed. You can achieve this by appending `exit 0` to the end of your `commandToExecute`.
 * > **NOTE:** Custom Script Extensions require that the Azure Virtual Machine Guest Agent is running on the Virtual Machine.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "acctvn",
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "acctsub",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 * });
 * const exampleNetworkInterface = new azure.network.NetworkInterface("example", {
 *     name: "acctni",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     ipConfigurations: [{
 *         name: "testconfiguration1",
 *         subnetId: exampleSubnet.id,
 *         privateIpAddressAllocation: "Dynamic",
 *     }],
 * });
 * const exampleLinuxVirtualMachine = new azure.compute.LinuxVirtualMachine("example", {
 *     name: "example-machine",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     size: "Standard_F2",
 *     adminUsername: "adminuser",
 *     networkInterfaceIds: [exampleNetworkInterface.id],
 *     adminSshKeys: [{
 *         username: "adminuser",
 *         publicKey: std.file({
 *             input: "~/.ssh/id_rsa.pub",
 *         }).then(invoke => invoke.result),
 *     }],
 *     osDisk: {
 *         caching: "ReadWrite",
 *         storageAccountType: "Standard_LRS",
 *     },
 *     sourceImageReference: {
 *         publisher: "Canonical",
 *         offer: "0001-com-ubuntu-server-jammy",
 *         sku: "22_04-lts",
 *         version: "latest",
 *     },
 * });
 * const exampleExtension = new azure.compute.Extension("example", {
 *     name: "hostname",
 *     virtualMachineId: exampleLinuxVirtualMachine.id,
 *     publisher: "Microsoft.Azure.Extensions",
 *     type: "CustomScript",
 *     typeHandlerVersion: "2.0",
 *     settings: ` {
 *   "commandToExecute": "hostname && uptime"
 *  }
 * `,
 *     tags: {
 *         environment: "Production",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_std as std
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_virtual_network = azure.network.VirtualNetwork("example",
 *     name="acctvn",
 *     address_spaces=["10.0.0.0/16"],
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_subnet = azure.network.Subnet("example",
 *     name="acctsub",
 *     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="acctni",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     ip_configurations=[azure.network.NetworkInterfaceIpConfigurationArgs(
 *         name="testconfiguration1",
 *         subnet_id=example_subnet.id,
 *         private_ip_address_allocation="Dynamic",
 *     )])
 * example_linux_virtual_machine = azure.compute.LinuxVirtualMachine("example",
 *     name="example-machine",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     size="Standard_F2",
 *     admin_username="adminuser",
 *     network_interface_ids=[example_network_interface.id],
 *     admin_ssh_keys=[azure.compute.LinuxVirtualMachineAdminSshKeyArgs(
 *         username="adminuser",
 *         public_key=std.file(input="~/.ssh/id_rsa.pub").result,
 *     )],
 *     os_disk=azure.compute.LinuxVirtualMachineOsDiskArgs(
 *         caching="ReadWrite",
 *         storage_account_type="Standard_LRS",
 *     ),
 *     source_image_reference=azure.compute.LinuxVirtualMachineSourceImageReferenceArgs(
 *         publisher="Canonical",
 *         offer="0001-com-ubuntu-server-jammy",
 *         sku="22_04-lts",
 *         version="latest",
 *     ))
 * example_extension = azure.compute.Extension("example",
 *     name="hostname",
 *     virtual_machine_id=example_linux_virtual_machine.id,
 *     publisher="Microsoft.Azure.Extensions",
 *     type="CustomScript",
 *     type_handler_version="2.0",
 *     settings=""" {
 *   "commandToExecute": "hostname && uptime"
 *  }
 * """,
 *     tags={
 *         "environment": "Production",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using Std = Pulumi.Std;
 * 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 = "acctvn",
 *         AddressSpaces = new[]
 *         {
 *             "10.0.0.0/16",
 *         },
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleSubnet = new Azure.Network.Subnet("example", new()
 *     {
 *         Name = "acctsub",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = exampleVirtualNetwork.Name,
 *         AddressPrefixes = new[]
 *         {
 *             "10.0.2.0/24",
 *         },
 *     });
 *     var exampleNetworkInterface = new Azure.Network.NetworkInterface("example", new()
 *     {
 *         Name = "acctni",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         IpConfigurations = new[]
 *         {
 *             new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
 *             {
 *                 Name = "testconfiguration1",
 *                 SubnetId = exampleSubnet.Id,
 *                 PrivateIpAddressAllocation = "Dynamic",
 *             },
 *         },
 *     });
 *     var exampleLinuxVirtualMachine = new Azure.Compute.LinuxVirtualMachine("example", new()
 *     {
 *         Name = "example-machine",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Size = "Standard_F2",
 *         AdminUsername = "adminuser",
 *         NetworkInterfaceIds = new[]
 *         {
 *             exampleNetworkInterface.Id,
 *         },
 *         AdminSshKeys = new[]
 *         {
 *             new Azure.Compute.Inputs.LinuxVirtualMachineAdminSshKeyArgs
 *             {
 *                 Username = "adminuser",
 *                 PublicKey = Std.File.Invoke(new()
 *                 {
 *                     Input = "~/.ssh/id_rsa.pub",
 *                 }).Apply(invoke => invoke.Result),
 *             },
 *         },
 *         OsDisk = new Azure.Compute.Inputs.LinuxVirtualMachineOsDiskArgs
 *         {
 *             Caching = "ReadWrite",
 *             StorageAccountType = "Standard_LRS",
 *         },
 *         SourceImageReference = new Azure.Compute.Inputs.LinuxVirtualMachineSourceImageReferenceArgs
 *         {
 *             Publisher = "Canonical",
 *             Offer = "0001-com-ubuntu-server-jammy",
 *             Sku = "22_04-lts",
 *             Version = "latest",
 *         },
 *     });
 *     var exampleExtension = new Azure.Compute.Extension("example", new()
 *     {
 *         Name = "hostname",
 *         VirtualMachineId = exampleLinuxVirtualMachine.Id,
 *         Publisher = "Microsoft.Azure.Extensions",
 *         Type = "CustomScript",
 *         TypeHandlerVersion = "2.0",
 *         Settings = @" {
 *   ""commandToExecute"": ""hostname && uptime""
 *  }
 * ",
 *         Tags =
 *         {
 *             { "environment", "Production" },
 *         },
 *     });
 * });
 * ```
 * ```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-std/sdk/go/std"
 * 	"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("acctvn"),
 * 			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("acctsub"),
 * 			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("acctni"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			IpConfigurations: network.NetworkInterfaceIpConfigurationArray{
 * 				&network.NetworkInterfaceIpConfigurationArgs{
 * 					Name:                       pulumi.String("testconfiguration1"),
 * 					SubnetId:                   exampleSubnet.ID(),
 * 					PrivateIpAddressAllocation: pulumi.String("Dynamic"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFile, err := std.File(ctx, &std.FileArgs{
 * 			Input: "~/.ssh/id_rsa.pub",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleLinuxVirtualMachine, err := compute.NewLinuxVirtualMachine(ctx, "example", &compute.LinuxVirtualMachineArgs{
 * 			Name:              pulumi.String("example-machine"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Size:              pulumi.String("Standard_F2"),
 * 			AdminUsername:     pulumi.String("adminuser"),
 * 			NetworkInterfaceIds: pulumi.StringArray{
 * 				exampleNetworkInterface.ID(),
 * 			},
 * 			AdminSshKeys: compute.LinuxVirtualMachineAdminSshKeyArray{
 * 				&compute.LinuxVirtualMachineAdminSshKeyArgs{
 * 					Username:  pulumi.String("adminuser"),
 * 					PublicKey: invokeFile.Result,
 * 				},
 * 			},
 * 			OsDisk: &compute.LinuxVirtualMachineOsDiskArgs{
 * 				Caching:            pulumi.String("ReadWrite"),
 * 				StorageAccountType: pulumi.String("Standard_LRS"),
 * 			},
 * 			SourceImageReference: &compute.LinuxVirtualMachineSourceImageReferenceArgs{
 * 				Publisher: pulumi.String("Canonical"),
 * 				Offer:     pulumi.String("0001-com-ubuntu-server-jammy"),
 * 				Sku:       pulumi.String("22_04-lts"),
 * 				Version:   pulumi.String("latest"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewExtension(ctx, "example", &compute.ExtensionArgs{
 * 			Name:               pulumi.String("hostname"),
 * 			VirtualMachineId:   exampleLinuxVirtualMachine.ID(),
 * 			Publisher:          pulumi.String("Microsoft.Azure.Extensions"),
 * 			Type:               pulumi.String("CustomScript"),
 * 			TypeHandlerVersion: pulumi.String("2.0"),
 * 			Settings:           pulumi.String(" {\n  \"commandToExecute\": \"hostname && uptime\"\n }\n"),
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("Production"),
 * 			},
 * 		})
 * 		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.LinuxVirtualMachine;
 * import com.pulumi.azure.compute.LinuxVirtualMachineArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineAdminSshKeyArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineOsDiskArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineSourceImageReferenceArgs;
 * import com.pulumi.azure.compute.Extension;
 * import com.pulumi.azure.compute.ExtensionArgs;
 * 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("acctvn")
 *             .addressSpaces("10.0.0.0/16")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("acctsub")
 *             .resourceGroupName(example.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes("10.0.2.0/24")
 *             .build());
 *         var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
 *             .name("acctni")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
 *                 .name("testconfiguration1")
 *                 .subnetId(exampleSubnet.id())
 *                 .privateIpAddressAllocation("Dynamic")
 *                 .build())
 *             .build());
 *         var exampleLinuxVirtualMachine = new LinuxVirtualMachine("exampleLinuxVirtualMachine", LinuxVirtualMachineArgs.builder()
 *             .name("example-machine")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .size("Standard_F2")
 *             .adminUsername("adminuser")
 *             .networkInterfaceIds(exampleNetworkInterface.id())
 *             .adminSshKeys(LinuxVirtualMachineAdminSshKeyArgs.builder()
 *                 .username("adminuser")
 *                 .publicKey(StdFunctions.file(FileArgs.builder()
 *                     .input("~/.ssh/id_rsa.pub")
 *                     .build()).result())
 *                 .build())
 *             .osDisk(LinuxVirtualMachineOsDiskArgs.builder()
 *                 .caching("ReadWrite")
 *                 .storageAccountType("Standard_LRS")
 *                 .build())
 *             .sourceImageReference(LinuxVirtualMachineSourceImageReferenceArgs.builder()
 *                 .publisher("Canonical")
 *                 .offer("0001-com-ubuntu-server-jammy")
 *                 .sku("22_04-lts")
 *                 .version("latest")
 *                 .build())
 *             .build());
 *         var exampleExtension = new Extension("exampleExtension", ExtensionArgs.builder()
 *             .name("hostname")
 *             .virtualMachineId(exampleLinuxVirtualMachine.id())
 *             .publisher("Microsoft.Azure.Extensions")
 *             .type("CustomScript")
 *             .typeHandlerVersion("2.0")
 *             .settings("""
 *  {
 *   "commandToExecute": "hostname && uptime"
 *  }
 *             """)
 *             .tags(Map.of("environment", "Production"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleVirtualNetwork:
 *     type: azure:network:VirtualNetwork
 *     name: example
 *     properties:
 *       name: acctvn
 *       addressSpaces:
 *         - 10.0.0.0/16
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleSubnet:
 *     type: azure:network:Subnet
 *     name: example
 *     properties:
 *       name: acctsub
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${exampleVirtualNetwork.name}
 *       addressPrefixes:
 *         - 10.0.2.0/24
 *   exampleNetworkInterface:
 *     type: azure:network:NetworkInterface
 *     name: example
 *     properties:
 *       name: acctni
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       ipConfigurations:
 *         - name: testconfiguration1
 *           subnetId: ${exampleSubnet.id}
 *           privateIpAddressAllocation: Dynamic
 *   exampleLinuxVirtualMachine:
 *     type: azure:compute:LinuxVirtualMachine
 *     name: example
 *     properties:
 *       name: example-machine
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       size: Standard_F2
 *       adminUsername: adminuser
 *       networkInterfaceIds:
 *         - ${exampleNetworkInterface.id}
 *       adminSshKeys:
 *         - username: adminuser
 *           publicKey:
 *             fn::invoke:
 *               Function: std:file
 *               Arguments:
 *                 input: ~/.ssh/id_rsa.pub
 *               Return: result
 *       osDisk:
 *         caching: ReadWrite
 *         storageAccountType: Standard_LRS
 *       sourceImageReference:
 *         publisher: Canonical
 *         offer: 0001-com-ubuntu-server-jammy
 *         sku: 22_04-lts
 *         version: latest
 *   exampleExtension:
 *     type: azure:compute:Extension
 *     name: example
 *     properties:
 *       name: hostname
 *       virtualMachineId: ${exampleLinuxVirtualMachine.id}
 *       publisher: Microsoft.Azure.Extensions
 *       type: CustomScript
 *       typeHandlerVersion: '2.0'
 *       settings: |2
 *          {
 *           "commandToExecute": "hostname && uptime"
 *          }
 *       tags:
 *         environment: Production
 * ```
 * 
 * ## Import
 * Virtual Machine Extensions can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:compute/extension:Extension example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/myVM/extensions/extensionName
 * ```
 * @property autoUpgradeMinorVersion Specifies if the platform deploys the latest minor version update to the `type_handler_version` specified.
 * @property automaticUpgradeEnabled Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension?
 * @property failureSuppressionEnabled Should failures from the extension be suppressed? Possible values are `true` or `false`. Defaults to `false`.
 * > **NOTE:** Operational failures such as not connecting to the VM will not be suppressed regardless of the `failure_suppression_enabled` value.
 * @property name The name of the virtual machine extension peering. Changing this forces a new resource to be created.
 * @property protectedSettings The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
 * > **Please Note:** Certain VM Extensions require that the keys in the `protected_settings` block are case sensitive. If you're seeing unhelpful errors, please ensure the keys are consistent with how Azure is expecting them (for instance, for the `JsonADDomainExtension` extension, the keys are expected to be in `TitleCase`.)
 * @property protectedSettingsFromKeyVault A `protected_settings_from_key_vault` block as defined below.
 * > **Note:** `protected_settings_from_key_vault` cannot be used with `protected_settings`
 * @property provisionAfterExtensions Specifies the collection of extension names after which this extension needs to be provisioned.
 * @property publisher The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
 * @property settings The settings passed to the extension, these are specified as a JSON object in a string.
 * > **Please Note:** Certain VM Extensions require that the keys in the `settings` block are case sensitive. If you're seeing unhelpful errors, please ensure the keys are consistent with how Azure is expecting them (for instance, for the `JsonADDomainExtension` extension, the keys are expected to be in `TitleCase`.)
 * @property tags A mapping of tags to assign to the resource.
 * @property type The type of extension, available types for a publisher can be found using the Azure CLI.
 * > **Note:** The `Publisher` and `Type` of Virtual Machine Extensions can be found using the Azure CLI, via:
 * ```shell
 * az vm extension image list --location westus -o table
 * ```
 * @property typeHandlerVersion Specifies the version of the extension to use, available versions can be found using the Azure CLI.
 * @property virtualMachineId The ID of the Virtual Machine. Changing this forces a new resource to be created
 */
public data class ExtensionArgs(
    public val autoUpgradeMinorVersion: Output? = null,
    public val automaticUpgradeEnabled: Output? = null,
    public val failureSuppressionEnabled: Output? = null,
    public val name: Output? = null,
    public val protectedSettings: Output? = null,
    public val protectedSettingsFromKeyVault: Output? =
        null,
    public val provisionAfterExtensions: Output>? = null,
    public val publisher: Output? = null,
    public val settings: Output? = null,
    public val tags: Output>? = null,
    public val type: Output? = null,
    public val typeHandlerVersion: Output? = null,
    public val virtualMachineId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.compute.ExtensionArgs =
        com.pulumi.azure.compute.ExtensionArgs.builder()
            .autoUpgradeMinorVersion(autoUpgradeMinorVersion?.applyValue({ args0 -> args0 }))
            .automaticUpgradeEnabled(automaticUpgradeEnabled?.applyValue({ args0 -> args0 }))
            .failureSuppressionEnabled(failureSuppressionEnabled?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .protectedSettings(protectedSettings?.applyValue({ args0 -> args0 }))
            .protectedSettingsFromKeyVault(
                protectedSettingsFromKeyVault?.applyValue({ args0 ->
                    args0.let({ args0 -> args0.toJava() })
                }),
            )
            .provisionAfterExtensions(
                provisionAfterExtensions?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0
                    })
                }),
            )
            .publisher(publisher?.applyValue({ args0 -> args0 }))
            .settings(settings?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .type(type?.applyValue({ args0 -> args0 }))
            .typeHandlerVersion(typeHandlerVersion?.applyValue({ args0 -> args0 }))
            .virtualMachineId(virtualMachineId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [ExtensionArgs].
 */
@PulumiTagMarker
public class ExtensionArgsBuilder internal constructor() {
    private var autoUpgradeMinorVersion: Output? = null

    private var automaticUpgradeEnabled: Output? = null

    private var failureSuppressionEnabled: Output? = null

    private var name: Output? = null

    private var protectedSettings: Output? = null

    private var protectedSettingsFromKeyVault: Output? =
        null

    private var provisionAfterExtensions: Output>? = null

    private var publisher: Output? = null

    private var settings: Output? = null

    private var tags: Output>? = null

    private var type: Output? = null

    private var typeHandlerVersion: Output? = null

    private var virtualMachineId: Output? = null

    /**
     * @param value Specifies if the platform deploys the latest minor version update to the `type_handler_version` specified.
     */
    @JvmName("cipcprbenjaetvst")
    public suspend fun autoUpgradeMinorVersion(`value`: Output) {
        this.autoUpgradeMinorVersion = value
    }

    /**
     * @param value Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension?
     */
    @JvmName("swubrpaloyxuuycw")
    public suspend fun automaticUpgradeEnabled(`value`: Output) {
        this.automaticUpgradeEnabled = value
    }

    /**
     * @param value Should failures from the extension be suppressed? Possible values are `true` or `false`. Defaults to `false`.
     * > **NOTE:** Operational failures such as not connecting to the VM will not be suppressed regardless of the `failure_suppression_enabled` value.
     */
    @JvmName("sgsiixxkcohgdekd")
    public suspend fun failureSuppressionEnabled(`value`: Output) {
        this.failureSuppressionEnabled = value
    }

    /**
     * @param value The name of the virtual machine extension peering. Changing this forces a new resource to be created.
     */
    @JvmName("juwmujoutfdqsnnk")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
     * > **Please Note:** Certain VM Extensions require that the keys in the `protected_settings` block are case sensitive. If you're seeing unhelpful errors, please ensure the keys are consistent with how Azure is expecting them (for instance, for the `JsonADDomainExtension` extension, the keys are expected to be in `TitleCase`.)
     */
    @JvmName("sulaogimqighfjau")
    public suspend fun protectedSettings(`value`: Output) {
        this.protectedSettings = value
    }

    /**
     * @param value A `protected_settings_from_key_vault` block as defined below.
     * > **Note:** `protected_settings_from_key_vault` cannot be used with `protected_settings`
     */
    @JvmName("nvodrjrcmrombabk")
    public suspend
    fun protectedSettingsFromKeyVault(`value`: Output) {
        this.protectedSettingsFromKeyVault = value
    }

    /**
     * @param value Specifies the collection of extension names after which this extension needs to be provisioned.
     */
    @JvmName("luuicuvlcgmsvcgi")
    public suspend fun provisionAfterExtensions(`value`: Output>) {
        this.provisionAfterExtensions = value
    }

    @JvmName("lltnekgtawsuvxum")
    public suspend fun provisionAfterExtensions(vararg values: Output) {
        this.provisionAfterExtensions = Output.all(values.asList())
    }

    /**
     * @param values Specifies the collection of extension names after which this extension needs to be provisioned.
     */
    @JvmName("lotljtwibnuxfwqm")
    public suspend fun provisionAfterExtensions(values: List>) {
        this.provisionAfterExtensions = Output.all(values)
    }

    /**
     * @param value The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
     */
    @JvmName("wdebtaqmqanfihck")
    public suspend fun publisher(`value`: Output) {
        this.publisher = value
    }

    /**
     * @param value The settings passed to the extension, these are specified as a JSON object in a string.
     * > **Please Note:** Certain VM Extensions require that the keys in the `settings` block are case sensitive. If you're seeing unhelpful errors, please ensure the keys are consistent with how Azure is expecting them (for instance, for the `JsonADDomainExtension` extension, the keys are expected to be in `TitleCase`.)
     */
    @JvmName("bjmqfbrpcjoapmtk")
    public suspend fun settings(`value`: Output) {
        this.settings = value
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("gwbdlawpejsypolu")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value The type of extension, available types for a publisher can be found using the Azure CLI.
     * > **Note:** The `Publisher` and `Type` of Virtual Machine Extensions can be found using the Azure CLI, via:
     * ```shell
     * az vm extension image list --location westus -o table
     * ```
     */
    @JvmName("rglopcdmnethmdym")
    public suspend fun type(`value`: Output) {
        this.type = value
    }

    /**
     * @param value Specifies the version of the extension to use, available versions can be found using the Azure CLI.
     */
    @JvmName("hlyffavxnvxecchw")
    public suspend fun typeHandlerVersion(`value`: Output) {
        this.typeHandlerVersion = value
    }

    /**
     * @param value The ID of the Virtual Machine. Changing this forces a new resource to be created
     */
    @JvmName("ufkxbkemwmhjjbye")
    public suspend fun virtualMachineId(`value`: Output) {
        this.virtualMachineId = value
    }

    /**
     * @param value Specifies if the platform deploys the latest minor version update to the `type_handler_version` specified.
     */
    @JvmName("gnrvhabagrupjgpd")
    public suspend fun autoUpgradeMinorVersion(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.autoUpgradeMinorVersion = mapped
    }

    /**
     * @param value Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension?
     */
    @JvmName("kutrlivvfoxxngpt")
    public suspend fun automaticUpgradeEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.automaticUpgradeEnabled = mapped
    }

    /**
     * @param value Should failures from the extension be suppressed? Possible values are `true` or `false`. Defaults to `false`.
     * > **NOTE:** Operational failures such as not connecting to the VM will not be suppressed regardless of the `failure_suppression_enabled` value.
     */
    @JvmName("yrnsgcidymuyqhrb")
    public suspend fun failureSuppressionEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.failureSuppressionEnabled = mapped
    }

    /**
     * @param value The name of the virtual machine extension peering. Changing this forces a new resource to be created.
     */
    @JvmName("fhmbxsqyfrhhsnvc")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
     * > **Please Note:** Certain VM Extensions require that the keys in the `protected_settings` block are case sensitive. If you're seeing unhelpful errors, please ensure the keys are consistent with how Azure is expecting them (for instance, for the `JsonADDomainExtension` extension, the keys are expected to be in `TitleCase`.)
     */
    @JvmName("byfeacqljxmaitxo")
    public suspend fun protectedSettings(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.protectedSettings = mapped
    }

    /**
     * @param value A `protected_settings_from_key_vault` block as defined below.
     * > **Note:** `protected_settings_from_key_vault` cannot be used with `protected_settings`
     */
    @JvmName("xigipmilxqxjjbue")
    public suspend
    fun protectedSettingsFromKeyVault(`value`: ExtensionProtectedSettingsFromKeyVaultArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.protectedSettingsFromKeyVault = mapped
    }

    /**
     * @param argument A `protected_settings_from_key_vault` block as defined below.
     * > **Note:** `protected_settings_from_key_vault` cannot be used with `protected_settings`
     */
    @JvmName("mfxaginjntxokpuj")
    public suspend
    fun protectedSettingsFromKeyVault(argument: suspend ExtensionProtectedSettingsFromKeyVaultArgsBuilder.() -> Unit) {
        val toBeMapped = ExtensionProtectedSettingsFromKeyVaultArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.protectedSettingsFromKeyVault = mapped
    }

    /**
     * @param value Specifies the collection of extension names after which this extension needs to be provisioned.
     */
    @JvmName("xojslhcsfpyenlbn")
    public suspend fun provisionAfterExtensions(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.provisionAfterExtensions = mapped
    }

    /**
     * @param values Specifies the collection of extension names after which this extension needs to be provisioned.
     */
    @JvmName("koqbleasogevbyjy")
    public suspend fun provisionAfterExtensions(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.provisionAfterExtensions = mapped
    }

    /**
     * @param value The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
     */
    @JvmName("hnfdutqlqoqlsjab")
    public suspend fun publisher(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.publisher = mapped
    }

    /**
     * @param value The settings passed to the extension, these are specified as a JSON object in a string.
     * > **Please Note:** Certain VM Extensions require that the keys in the `settings` block are case sensitive. If you're seeing unhelpful errors, please ensure the keys are consistent with how Azure is expecting them (for instance, for the `JsonADDomainExtension` extension, the keys are expected to be in `TitleCase`.)
     */
    @JvmName("trajydqphfpramaq")
    public suspend fun settings(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.settings = mapped
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("maldwotesotjkcgu")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags to assign to the resource.
     */
    @JvmName("cornuiwnodaacgpt")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value The type of extension, available types for a publisher can be found using the Azure CLI.
     * > **Note:** The `Publisher` and `Type` of Virtual Machine Extensions can be found using the Azure CLI, via:
     * ```shell
     * az vm extension image list --location westus -o table
     * ```
     */
    @JvmName("svvqsiiervpdmxdt")
    public suspend fun type(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.type = mapped
    }

    /**
     * @param value Specifies the version of the extension to use, available versions can be found using the Azure CLI.
     */
    @JvmName("eylwmpxgbgaaxqms")
    public suspend fun typeHandlerVersion(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.typeHandlerVersion = mapped
    }

    /**
     * @param value The ID of the Virtual Machine. Changing this forces a new resource to be created
     */
    @JvmName("pdoikpxomoqflnwl")
    public suspend fun virtualMachineId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.virtualMachineId = mapped
    }

    internal fun build(): ExtensionArgs = ExtensionArgs(
        autoUpgradeMinorVersion = autoUpgradeMinorVersion,
        automaticUpgradeEnabled = automaticUpgradeEnabled,
        failureSuppressionEnabled = failureSuppressionEnabled,
        name = name,
        protectedSettings = protectedSettings,
        protectedSettingsFromKeyVault = protectedSettingsFromKeyVault,
        provisionAfterExtensions = provisionAfterExtensions,
        publisher = publisher,
        settings = settings,
        tags = tags,
        type = type,
        typeHandlerVersion = typeHandlerVersion,
        virtualMachineId = virtualMachineId,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy