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

com.pulumi.azure.blueprint.kotlin.Assignment.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.blueprint.kotlin

import com.pulumi.azure.blueprint.kotlin.outputs.AssignmentIdentity
import com.pulumi.azure.blueprint.kotlin.outputs.AssignmentIdentity.Companion.toKotlin
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: AssignmentArgs = AssignmentArgs()

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

/**
 * Manages a Blueprint Assignment resource
 * > **NOTE:** Azure Blueprints are in Preview and potentially subject to breaking change without notice.
 * > **NOTE:** Azure Blueprint Assignments can only be applied to Subscriptions.  Assignments to Management Groups is not currently supported by the service or by this provider.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const current = azure.core.getClientConfig({});
 * const example = azure.core.getSubscription({});
 * const exampleGetDefinition = example.then(example => azure.blueprint.getDefinition({
 *     name: "exampleBlueprint",
 *     scopeId: example.id,
 * }));
 * const exampleGetPublishedVersion = Promise.all([exampleGetDefinition, exampleGetDefinition]).then(([exampleGetDefinition, exampleGetDefinition1]) => azure.blueprint.getPublishedVersion({
 *     scopeId: exampleGetDefinition.scopeId,
 *     blueprintName: exampleGetDefinition1.name,
 *     version: "v1.0.0",
 * }));
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "exampleRG-bp",
 *     location: "West Europe",
 *     tags: {
 *         Environment: "example",
 *     },
 * });
 * const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     name: "bp-user-example",
 * });
 * const operator = new azure.authorization.Assignment("operator", {
 *     scope: example.then(example => example.id),
 *     roleDefinitionName: "Blueprint Operator",
 *     principalId: exampleUserAssignedIdentity.principalId,
 * });
 * const owner = new azure.authorization.Assignment("owner", {
 *     scope: example.then(example => example.id),
 *     roleDefinitionName: "Owner",
 *     principalId: exampleUserAssignedIdentity.principalId,
 * });
 * const exampleAssignment = new azure.blueprint.Assignment("example", {
 *     name: "testAccBPAssignment",
 *     targetSubscriptionId: example.then(example => example.id),
 *     versionId: exampleGetPublishedVersion.then(exampleGetPublishedVersion => exampleGetPublishedVersion.id),
 *     location: exampleResourceGroup.location,
 *     lockMode: "AllResourcesDoNotDelete",
 *     lockExcludePrincipals: [current.then(current => current.objectId)],
 *     identity: {
 *         type: "UserAssigned",
 *         identityIds: [exampleUserAssignedIdentity.id],
 *     },
 *     resourceGroups: `    {
 *       "ResourceGroup": {
 *         "name": "exampleRG-bp"
 *       }
 *     }
 * `,
 *     parameterValues: `    {
 *       "allowedlocationsforresourcegroups_listOfAllowedLocations": {
 *         "value": ["westus", "westus2", "eastus", "centralus", "centraluseuap", "southcentralus", "northcentralus", "westcentralus", "eastus2", "eastus2euap", "brazilsouth", "brazilus", "northeurope", "westeurope", "eastasia", "southeastasia", "japanwest", "japaneast", "koreacentral", "koreasouth", "indiasouth", "indiawest", "indiacentral", "australiaeast", "australiasoutheast", "canadacentral", "canadaeast", "uknorth", "uksouth2", "uksouth", "ukwest", "francecentral", "francesouth", "australiacentral", "australiacentral2", "uaecentral", "uaenorth", "southafricanorth", "southafricawest", "switzerlandnorth", "switzerlandwest", "germanynorth", "germanywestcentral", "norwayeast", "norwaywest"]
 *       }
 *     }
 * `,
 * }, {
 *     dependsOn: [
 *         operator,
 *         owner,
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * current = azure.core.get_client_config()
 * example = azure.core.get_subscription()
 * example_get_definition = azure.blueprint.get_definition(name="exampleBlueprint",
 *     scope_id=example.id)
 * example_get_published_version = azure.blueprint.get_published_version(scope_id=example_get_definition.scope_id,
 *     blueprint_name=example_get_definition.name,
 *     version="v1.0.0")
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="exampleRG-bp",
 *     location="West Europe",
 *     tags={
 *         "Environment": "example",
 *     })
 * example_user_assigned_identity = azure.authorization.UserAssignedIdentity("example",
 *     resource_group_name=example_resource_group.name,
 *     location=example_resource_group.location,
 *     name="bp-user-example")
 * operator = azure.authorization.Assignment("operator",
 *     scope=example.id,
 *     role_definition_name="Blueprint Operator",
 *     principal_id=example_user_assigned_identity.principal_id)
 * owner = azure.authorization.Assignment("owner",
 *     scope=example.id,
 *     role_definition_name="Owner",
 *     principal_id=example_user_assigned_identity.principal_id)
 * example_assignment = azure.blueprint.Assignment("example",
 *     name="testAccBPAssignment",
 *     target_subscription_id=example.id,
 *     version_id=example_get_published_version.id,
 *     location=example_resource_group.location,
 *     lock_mode="AllResourcesDoNotDelete",
 *     lock_exclude_principals=[current.object_id],
 *     identity={
 *         "type": "UserAssigned",
 *         "identity_ids": [example_user_assigned_identity.id],
 *     },
 *     resource_groups="""    {
 *       "ResourceGroup": {
 *         "name": "exampleRG-bp"
 *       }
 *     }
 * """,
 *     parameter_values="""    {
 *       "allowedlocationsforresourcegroups_listOfAllowedLocations": {
 *         "value": ["westus", "westus2", "eastus", "centralus", "centraluseuap", "southcentralus", "northcentralus", "westcentralus", "eastus2", "eastus2euap", "brazilsouth", "brazilus", "northeurope", "westeurope", "eastasia", "southeastasia", "japanwest", "japaneast", "koreacentral", "koreasouth", "indiasouth", "indiawest", "indiacentral", "australiaeast", "australiasoutheast", "canadacentral", "canadaeast", "uknorth", "uksouth2", "uksouth", "ukwest", "francecentral", "francesouth", "australiacentral", "australiacentral2", "uaecentral", "uaenorth", "southafricanorth", "southafricawest", "switzerlandnorth", "switzerlandwest", "germanynorth", "germanywestcentral", "norwayeast", "norwaywest"]
 *       }
 *     }
 * """,
 *     opts = pulumi.ResourceOptions(depends_on=[
 *             operator,
 *             owner,
 *         ]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var current = Azure.Core.GetClientConfig.Invoke();
 *     var example = Azure.Core.GetSubscription.Invoke();
 *     var exampleGetDefinition = Azure.Blueprint.GetDefinition.Invoke(new()
 *     {
 *         Name = "exampleBlueprint",
 *         ScopeId = example.Apply(getSubscriptionResult => getSubscriptionResult.Id),
 *     });
 *     var exampleGetPublishedVersion = Azure.Blueprint.GetPublishedVersion.Invoke(new()
 *     {
 *         ScopeId = exampleGetDefinition.Apply(getDefinitionResult => getDefinitionResult.ScopeId),
 *         BlueprintName = exampleGetDefinition.Apply(getDefinitionResult => getDefinitionResult.Name),
 *         Version = "v1.0.0",
 *     });
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "exampleRG-bp",
 *         Location = "West Europe",
 *         Tags =
 *         {
 *             { "Environment", "example" },
 *         },
 *     });
 *     var exampleUserAssignedIdentity = new Azure.Authorization.UserAssignedIdentity("example", new()
 *     {
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Location = exampleResourceGroup.Location,
 *         Name = "bp-user-example",
 *     });
 *     var @operator = new Azure.Authorization.Assignment("operator", new()
 *     {
 *         Scope = example.Apply(getSubscriptionResult => getSubscriptionResult.Id),
 *         RoleDefinitionName = "Blueprint Operator",
 *         PrincipalId = exampleUserAssignedIdentity.PrincipalId,
 *     });
 *     var owner = new Azure.Authorization.Assignment("owner", new()
 *     {
 *         Scope = example.Apply(getSubscriptionResult => getSubscriptionResult.Id),
 *         RoleDefinitionName = "Owner",
 *         PrincipalId = exampleUserAssignedIdentity.PrincipalId,
 *     });
 *     var exampleAssignment = new Azure.Blueprint.Assignment("example", new()
 *     {
 *         Name = "testAccBPAssignment",
 *         TargetSubscriptionId = example.Apply(getSubscriptionResult => getSubscriptionResult.Id),
 *         VersionId = exampleGetPublishedVersion.Apply(getPublishedVersionResult => getPublishedVersionResult.Id),
 *         Location = exampleResourceGroup.Location,
 *         LockMode = "AllResourcesDoNotDelete",
 *         LockExcludePrincipals = new[]
 *         {
 *             current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *         },
 *         Identity = new Azure.Blueprint.Inputs.AssignmentIdentityArgs
 *         {
 *             Type = "UserAssigned",
 *             IdentityIds = new[]
 *             {
 *                 exampleUserAssignedIdentity.Id,
 *             },
 *         },
 *         ResourceGroups = @"    {
 *       ""ResourceGroup"": {
 *         ""name"": ""exampleRG-bp""
 *       }
 *     }
 * ",
 *         ParameterValues = @"    {
 *       ""allowedlocationsforresourcegroups_listOfAllowedLocations"": {
 *         ""value"": [""westus"", ""westus2"", ""eastus"", ""centralus"", ""centraluseuap"", ""southcentralus"", ""northcentralus"", ""westcentralus"", ""eastus2"", ""eastus2euap"", ""brazilsouth"", ""brazilus"", ""northeurope"", ""westeurope"", ""eastasia"", ""southeastasia"", ""japanwest"", ""japaneast"", ""koreacentral"", ""koreasouth"", ""indiasouth"", ""indiawest"", ""indiacentral"", ""australiaeast"", ""australiasoutheast"", ""canadacentral"", ""canadaeast"", ""uknorth"", ""uksouth2"", ""uksouth"", ""ukwest"", ""francecentral"", ""francesouth"", ""australiacentral"", ""australiacentral2"", ""uaecentral"", ""uaenorth"", ""southafricanorth"", ""southafricawest"", ""switzerlandnorth"", ""switzerlandwest"", ""germanynorth"", ""germanywestcentral"", ""norwayeast"", ""norwaywest""]
 *       }
 *     }
 * ",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             @operator,
 *             owner,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/blueprint"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		current, err := core.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := core.LookupSubscription(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleGetDefinition, err := blueprint.GetDefinition(ctx, &blueprint.GetDefinitionArgs{
 * 			Name:    "exampleBlueprint",
 * 			ScopeId: example.Id,
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleGetPublishedVersion, err := blueprint.GetPublishedVersion(ctx, &blueprint.GetPublishedVersionArgs{
 * 			ScopeId:       exampleGetDefinition.ScopeId,
 * 			BlueprintName: exampleGetDefinition.Name,
 * 			Version:       "v1.0.0",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("exampleRG-bp"),
 * 			Location: pulumi.String("West Europe"),
 * 			Tags: pulumi.StringMap{
 * 				"Environment": pulumi.String("example"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleUserAssignedIdentity, err := authorization.NewUserAssignedIdentity(ctx, "example", &authorization.UserAssignedIdentityArgs{
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			Location:          exampleResourceGroup.Location,
 * 			Name:              pulumi.String("bp-user-example"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		operator, err := authorization.NewAssignment(ctx, "operator", &authorization.AssignmentArgs{
 * 			Scope:              pulumi.String(example.Id),
 * 			RoleDefinitionName: pulumi.String("Blueprint Operator"),
 * 			PrincipalId:        exampleUserAssignedIdentity.PrincipalId,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		owner, err := authorization.NewAssignment(ctx, "owner", &authorization.AssignmentArgs{
 * 			Scope:              pulumi.String(example.Id),
 * 			RoleDefinitionName: pulumi.String("Owner"),
 * 			PrincipalId:        exampleUserAssignedIdentity.PrincipalId,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = blueprint.NewAssignment(ctx, "example", &blueprint.AssignmentArgs{
 * 			Name:                 pulumi.String("testAccBPAssignment"),
 * 			TargetSubscriptionId: pulumi.String(example.Id),
 * 			VersionId:            pulumi.String(exampleGetPublishedVersion.Id),
 * 			Location:             exampleResourceGroup.Location,
 * 			LockMode:             pulumi.String("AllResourcesDoNotDelete"),
 * 			LockExcludePrincipals: pulumi.StringArray{
 * 				pulumi.String(current.ObjectId),
 * 			},
 * 			Identity: &blueprint.AssignmentIdentityArgs{
 * 				Type: pulumi.String("UserAssigned"),
 * 				IdentityIds: pulumi.StringArray{
 * 					exampleUserAssignedIdentity.ID(),
 * 				},
 * 			},
 * 			ResourceGroups: pulumi.String(`    {
 *       "ResourceGroup": {
 *         "name": "exampleRG-bp"
 *       }
 *     }
 * `),
 * 			ParameterValues: pulumi.String(`    {
 *       "allowedlocationsforresourcegroups_listOfAllowedLocations": {
 *         "value": ["westus", "westus2", "eastus", "centralus", "centraluseuap", "southcentralus", "northcentralus", "westcentralus", "eastus2", "eastus2euap", "brazilsouth", "brazilus", "northeurope", "westeurope", "eastasia", "southeastasia", "japanwest", "japaneast", "koreacentral", "koreasouth", "indiasouth", "indiawest", "indiacentral", "australiaeast", "australiasoutheast", "canadacentral", "canadaeast", "uknorth", "uksouth2", "uksouth", "ukwest", "francecentral", "francesouth", "australiacentral", "australiacentral2", "uaecentral", "uaenorth", "southafricanorth", "southafricawest", "switzerlandnorth", "switzerlandwest", "germanynorth", "germanywestcentral", "norwayeast", "norwaywest"]
 *       }
 *     }
 * `),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			operator,
 * 			owner,
 * 		}))
 * 		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.CoreFunctions;
 * import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
 * import com.pulumi.azure.blueprint.BlueprintFunctions;
 * import com.pulumi.azure.blueprint.inputs.GetDefinitionArgs;
 * import com.pulumi.azure.blueprint.inputs.GetPublishedVersionArgs;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.authorization.UserAssignedIdentity;
 * import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * import com.pulumi.azure.blueprint.Assignment;
 * import com.pulumi.azure.blueprint.AssignmentArgs;
 * import com.pulumi.azure.blueprint.inputs.AssignmentIdentityArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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) {
 *         final var current = CoreFunctions.getClientConfig();
 *         final var example = CoreFunctions.getSubscription();
 *         final var exampleGetDefinition = BlueprintFunctions.getDefinition(GetDefinitionArgs.builder()
 *             .name("exampleBlueprint")
 *             .scopeId(example.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
 *             .build());
 *         final var exampleGetPublishedVersion = BlueprintFunctions.getPublishedVersion(GetPublishedVersionArgs.builder()
 *             .scopeId(exampleGetDefinition.applyValue(getDefinitionResult -> getDefinitionResult.scopeId()))
 *             .blueprintName(exampleGetDefinition.applyValue(getDefinitionResult -> getDefinitionResult.name()))
 *             .version("v1.0.0")
 *             .build());
 *         var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .name("exampleRG-bp")
 *             .location("West Europe")
 *             .tags(Map.of("Environment", "example"))
 *             .build());
 *         var exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .name("bp-user-example")
 *             .build());
 *         var operator = new Assignment("operator", AssignmentArgs.builder()
 *             .scope(example.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
 *             .roleDefinitionName("Blueprint Operator")
 *             .principalId(exampleUserAssignedIdentity.principalId())
 *             .build());
 *         var owner = new Assignment("owner", AssignmentArgs.builder()
 *             .scope(example.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
 *             .roleDefinitionName("Owner")
 *             .principalId(exampleUserAssignedIdentity.principalId())
 *             .build());
 *         var exampleAssignment = new Assignment("exampleAssignment", AssignmentArgs.builder()
 *             .name("testAccBPAssignment")
 *             .targetSubscriptionId(example.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
 *             .versionId(exampleGetPublishedVersion.applyValue(getPublishedVersionResult -> getPublishedVersionResult.id()))
 *             .location(exampleResourceGroup.location())
 *             .lockMode("AllResourcesDoNotDelete")
 *             .lockExcludePrincipals(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *             .identity(AssignmentIdentityArgs.builder()
 *                 .type("UserAssigned")
 *                 .identityIds(exampleUserAssignedIdentity.id())
 *                 .build())
 *             .resourceGroups("""
 *     {
 *       "ResourceGroup": {
 *         "name": "exampleRG-bp"
 *       }
 *     }
 *             """)
 *             .parameterValues("""
 *     {
 *       "allowedlocationsforresourcegroups_listOfAllowedLocations": {
 *         "value": ["westus", "westus2", "eastus", "centralus", "centraluseuap", "southcentralus", "northcentralus", "westcentralus", "eastus2", "eastus2euap", "brazilsouth", "brazilus", "northeurope", "westeurope", "eastasia", "southeastasia", "japanwest", "japaneast", "koreacentral", "koreasouth", "indiasouth", "indiawest", "indiacentral", "australiaeast", "australiasoutheast", "canadacentral", "canadaeast", "uknorth", "uksouth2", "uksouth", "ukwest", "francecentral", "francesouth", "australiacentral", "australiacentral2", "uaecentral", "uaenorth", "southafricanorth", "southafricawest", "switzerlandnorth", "switzerlandwest", "germanynorth", "germanywestcentral", "norwayeast", "norwaywest"]
 *       }
 *     }
 *             """)
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(
 *                     operator,
 *                     owner)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: exampleRG-bp
 *       location: West Europe
 *       tags:
 *         Environment: example
 *   exampleUserAssignedIdentity:
 *     type: azure:authorization:UserAssignedIdentity
 *     name: example
 *     properties:
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       location: ${exampleResourceGroup.location}
 *       name: bp-user-example
 *   operator:
 *     type: azure:authorization:Assignment
 *     properties:
 *       scope: ${example.id}
 *       roleDefinitionName: Blueprint Operator
 *       principalId: ${exampleUserAssignedIdentity.principalId}
 *   owner:
 *     type: azure:authorization:Assignment
 *     properties:
 *       scope: ${example.id}
 *       roleDefinitionName: Owner
 *       principalId: ${exampleUserAssignedIdentity.principalId}
 *   exampleAssignment:
 *     type: azure:blueprint:Assignment
 *     name: example
 *     properties:
 *       name: testAccBPAssignment
 *       targetSubscriptionId: ${example.id}
 *       versionId: ${exampleGetPublishedVersion.id}
 *       location: ${exampleResourceGroup.location}
 *       lockMode: AllResourcesDoNotDelete
 *       lockExcludePrincipals:
 *         - ${current.objectId}
 *       identity:
 *         type: UserAssigned
 *         identityIds:
 *           - ${exampleUserAssignedIdentity.id}
 *       resourceGroups: |2
 *             {
 *               "ResourceGroup": {
 *                 "name": "exampleRG-bp"
 *               }
 *             }
 *       parameterValues: |2
 *             {
 *               "allowedlocationsforresourcegroups_listOfAllowedLocations": {
 *                 "value": ["westus", "westus2", "eastus", "centralus", "centraluseuap", "southcentralus", "northcentralus", "westcentralus", "eastus2", "eastus2euap", "brazilsouth", "brazilus", "northeurope", "westeurope", "eastasia", "southeastasia", "japanwest", "japaneast", "koreacentral", "koreasouth", "indiasouth", "indiawest", "indiacentral", "australiaeast", "australiasoutheast", "canadacentral", "canadaeast", "uknorth", "uksouth2", "uksouth", "ukwest", "francecentral", "francesouth", "australiacentral", "australiacentral2", "uaecentral", "uaenorth", "southafricanorth", "southafricawest", "switzerlandnorth", "switzerlandwest", "germanynorth", "germanywestcentral", "norwayeast", "norwaywest"]
 *               }
 *             }
 *     options:
 *       dependson:
 *         - ${operator}
 *         - ${owner}
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 *   example:
 *     fn::invoke:
 *       Function: azure:core:getSubscription
 *       Arguments: {}
 *   exampleGetDefinition:
 *     fn::invoke:
 *       Function: azure:blueprint:getDefinition
 *       Arguments:
 *         name: exampleBlueprint
 *         scopeId: ${example.id}
 *   exampleGetPublishedVersion:
 *     fn::invoke:
 *       Function: azure:blueprint:getPublishedVersion
 *       Arguments:
 *         scopeId: ${exampleGetDefinition.scopeId}
 *         blueprintName: ${exampleGetDefinition.name}
 *         version: v1.0.0
 * ```
 * 
 * ## Import
 * Azure Blueprint Assignments can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:blueprint/assignment:Assignment example "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint"
 * ```
 */
public class Assignment internal constructor(
    override val javaResource: com.pulumi.azure.blueprint.Assignment,
) : KotlinCustomResource(javaResource, AssignmentMapper) {
    /**
     * The name of the blueprint assigned
     */
    public val blueprintName: Output
        get() = javaResource.blueprintName().applyValue({ args0 -> args0 })

    /**
     * The Description on the Blueprint
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * The display name of the blueprint
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

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

    /**
     * The Azure location of the Assignment. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * a list of up to 200 actions that are permitted to bypass the locks applied by the Blueprint.
     */
    public val lockExcludeActions: Output>?
        get() = javaResource.lockExcludeActions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * a list of up to 5 Principal IDs that are permitted to bypass the locks applied by the Blueprint.
     */
    public val lockExcludePrincipals: Output>?
        get() = javaResource.lockExcludePrincipals().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The locking mode of the Blueprint Assignment. One of `None` (Default), `AllResourcesReadOnly`, or `AllResourcesDoNotDelete`. Defaults to `None`.
     */
    public val lockMode: Output?
        get() = javaResource.lockMode().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

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

    /**
     * a JSON string to supply Blueprint Assignment parameter values.
     * > **NOTE:** Improperly formatted JSON, or missing values required by a Blueprint will cause the assignment to fail.
     */
    public val parameterValues: Output?
        get() = javaResource.parameterValues().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * a JSON string to supply the Blueprint Resource Group information.
     * > **NOTE:** Improperly formatted JSON, or missing values required by a Blueprint will cause the assignment to fail.
     */
    public val resourceGroups: Output?
        get() = javaResource.resourceGroups().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Subscription ID the Blueprint Published Version is to be applied to. Changing this forces a new resource to be created.
     */
    public val targetSubscriptionId: Output
        get() = javaResource.targetSubscriptionId().applyValue({ args0 -> args0 })

    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * The ID of the Published Version of the blueprint to be assigned.
     */
    public val versionId: Output
        get() = javaResource.versionId().applyValue({ args0 -> args0 })
}

public object AssignmentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.blueprint.Assignment::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy