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

com.pulumi.azure.keyvault.kotlin.ManagedStorageAccount.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.keyvault.kotlin

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.Map

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

    public var args: ManagedStorageAccountArgs = ManagedStorageAccountArgs()

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

/**
 * Manages a Key Vault Managed Storage Account.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const current = azure.core.getClientConfig({});
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "storageaccountname",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleKeyVault = new azure.keyvault.KeyVault("example", {
 *     name: "keyvaultname",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     tenantId: current.then(current => current.tenantId),
 *     skuName: "standard",
 *     accessPolicies: [{
 *         tenantId: current.then(current => current.tenantId),
 *         objectId: current.then(current => current.objectId),
 *         secretPermissions: [
 *             "Get",
 *             "Delete",
 *         ],
 *         storagePermissions: [
 *             "Get",
 *             "List",
 *             "Set",
 *             "SetSAS",
 *             "GetSAS",
 *             "DeleteSAS",
 *             "Update",
 *             "RegenerateKey",
 *         ],
 *     }],
 * });
 * const exampleManagedStorageAccount = new azure.keyvault.ManagedStorageAccount("example", {
 *     name: "examplemanagedstorage",
 *     keyVaultId: exampleKeyVault.id,
 *     storageAccountId: exampleAccount.id,
 *     storageAccountKey: "key1",
 *     regenerateKeyAutomatically: false,
 *     regenerationPeriod: "P1D",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * current = azure.core.get_client_config()
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="storageaccountname",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_key_vault = azure.keyvault.KeyVault("example",
 *     name="keyvaultname",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     tenant_id=current.tenant_id,
 *     sku_name="standard",
 *     access_policies=[{
 *         "tenant_id": current.tenant_id,
 *         "object_id": current.object_id,
 *         "secret_permissions": [
 *             "Get",
 *             "Delete",
 *         ],
 *         "storage_permissions": [
 *             "Get",
 *             "List",
 *             "Set",
 *             "SetSAS",
 *             "GetSAS",
 *             "DeleteSAS",
 *             "Update",
 *             "RegenerateKey",
 *         ],
 *     }])
 * example_managed_storage_account = azure.keyvault.ManagedStorageAccount("example",
 *     name="examplemanagedstorage",
 *     key_vault_id=example_key_vault.id,
 *     storage_account_id=example_account.id,
 *     storage_account_key="key1",
 *     regenerate_key_automatically=False,
 *     regeneration_period="P1D")
 * ```
 * ```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 = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "storageaccountname",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleKeyVault = new Azure.KeyVault.KeyVault("example", new()
 *     {
 *         Name = "keyvaultname",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *         SkuName = "standard",
 *         AccessPolicies = new[]
 *         {
 *             new Azure.KeyVault.Inputs.KeyVaultAccessPolicyArgs
 *             {
 *                 TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *                 ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *                 SecretPermissions = new[]
 *                 {
 *                     "Get",
 *                     "Delete",
 *                 },
 *                 StoragePermissions = new[]
 *                 {
 *                     "Get",
 *                     "List",
 *                     "Set",
 *                     "SetSAS",
 *                     "GetSAS",
 *                     "DeleteSAS",
 *                     "Update",
 *                     "RegenerateKey",
 *                 },
 *             },
 *         },
 *     });
 *     var exampleManagedStorageAccount = new Azure.KeyVault.ManagedStorageAccount("example", new()
 *     {
 *         Name = "examplemanagedstorage",
 *         KeyVaultId = exampleKeyVault.Id,
 *         StorageAccountId = exampleAccount.Id,
 *         StorageAccountKey = "key1",
 *         RegenerateKeyAutomatically = false,
 *         RegenerationPeriod = "P1D",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/keyvault"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"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.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("storageaccountname"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleKeyVault, err := keyvault.NewKeyVault(ctx, "example", &keyvault.KeyVaultArgs{
 * 			Name:              pulumi.String("keyvaultname"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			TenantId:          pulumi.String(current.TenantId),
 * 			SkuName:           pulumi.String("standard"),
 * 			AccessPolicies: keyvault.KeyVaultAccessPolicyArray{
 * 				&keyvault.KeyVaultAccessPolicyArgs{
 * 					TenantId: pulumi.String(current.TenantId),
 * 					ObjectId: pulumi.String(current.ObjectId),
 * 					SecretPermissions: pulumi.StringArray{
 * 						pulumi.String("Get"),
 * 						pulumi.String("Delete"),
 * 					},
 * 					StoragePermissions: pulumi.StringArray{
 * 						pulumi.String("Get"),
 * 						pulumi.String("List"),
 * 						pulumi.String("Set"),
 * 						pulumi.String("SetSAS"),
 * 						pulumi.String("GetSAS"),
 * 						pulumi.String("DeleteSAS"),
 * 						pulumi.String("Update"),
 * 						pulumi.String("RegenerateKey"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = keyvault.NewManagedStorageAccount(ctx, "example", &keyvault.ManagedStorageAccountArgs{
 * 			Name:                       pulumi.String("examplemanagedstorage"),
 * 			KeyVaultId:                 exampleKeyVault.ID(),
 * 			StorageAccountId:           exampleAccount.ID(),
 * 			StorageAccountKey:          pulumi.String("key1"),
 * 			RegenerateKeyAutomatically: pulumi.Bool(false),
 * 			RegenerationPeriod:         pulumi.String("P1D"),
 * 		})
 * 		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.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.keyvault.KeyVault;
 * import com.pulumi.azure.keyvault.KeyVaultArgs;
 * import com.pulumi.azure.keyvault.inputs.KeyVaultAccessPolicyArgs;
 * import com.pulumi.azure.keyvault.ManagedStorageAccount;
 * import com.pulumi.azure.keyvault.ManagedStorageAccountArgs;
 * 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();
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("storageaccountname")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
 *             .name("keyvaultname")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .skuName("standard")
 *             .accessPolicies(KeyVaultAccessPolicyArgs.builder()
 *                 .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *                 .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *                 .secretPermissions(
 *                     "Get",
 *                     "Delete")
 *                 .storagePermissions(
 *                     "Get",
 *                     "List",
 *                     "Set",
 *                     "SetSAS",
 *                     "GetSAS",
 *                     "DeleteSAS",
 *                     "Update",
 *                     "RegenerateKey")
 *                 .build())
 *             .build());
 *         var exampleManagedStorageAccount = new ManagedStorageAccount("exampleManagedStorageAccount", ManagedStorageAccountArgs.builder()
 *             .name("examplemanagedstorage")
 *             .keyVaultId(exampleKeyVault.id())
 *             .storageAccountId(exampleAccount.id())
 *             .storageAccountKey("key1")
 *             .regenerateKeyAutomatically(false)
 *             .regenerationPeriod("P1D")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: storageaccountname
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleKeyVault:
 *     type: azure:keyvault:KeyVault
 *     name: example
 *     properties:
 *       name: keyvaultname
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       tenantId: ${current.tenantId}
 *       skuName: standard
 *       accessPolicies:
 *         - tenantId: ${current.tenantId}
 *           objectId: ${current.objectId}
 *           secretPermissions:
 *             - Get
 *             - Delete
 *           storagePermissions:
 *             - Get
 *             - List
 *             - Set
 *             - SetSAS
 *             - GetSAS
 *             - DeleteSAS
 *             - Update
 *             - RegenerateKey
 *   exampleManagedStorageAccount:
 *     type: azure:keyvault:ManagedStorageAccount
 *     name: example
 *     properties:
 *       name: examplemanagedstorage
 *       keyVaultId: ${exampleKeyVault.id}
 *       storageAccountId: ${exampleAccount.id}
 *       storageAccountKey: key1
 *       regenerateKeyAutomatically: false
 *       regenerationPeriod: P1D
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ### Automatically Regenerate Storage Account Access Key)
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as azuread from "@pulumi/azuread";
 * const current = azure.core.getClientConfig({});
 * const test = azuread.getServicePrincipal({
 *     applicationId: "cfa8b339-82a2-471a-a3c9-0fc0be7a4093",
 * });
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "storageaccountname",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleKeyVault = new azure.keyvault.KeyVault("example", {
 *     name: "keyvaultname",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     tenantId: current.then(current => current.tenantId),
 *     skuName: "standard",
 *     accessPolicies: [{
 *         tenantId: current.then(current => current.tenantId),
 *         objectId: current.then(current => current.objectId),
 *         secretPermissions: [
 *             "Get",
 *             "Delete",
 *         ],
 *         storagePermissions: [
 *             "Get",
 *             "List",
 *             "Set",
 *             "SetSAS",
 *             "GetSAS",
 *             "DeleteSAS",
 *             "Update",
 *             "RegenerateKey",
 *         ],
 *     }],
 * });
 * const exampleAssignment = new azure.authorization.Assignment("example", {
 *     scope: exampleAccount.id,
 *     roleDefinitionName: "Storage Account Key Operator Service Role",
 *     principalId: test.then(test => test.id),
 * });
 * const exampleManagedStorageAccount = new azure.keyvault.ManagedStorageAccount("example", {
 *     name: "examplemanagedstorage",
 *     keyVaultId: exampleKeyVault.id,
 *     storageAccountId: exampleAccount.id,
 *     storageAccountKey: "key1",
 *     regenerateKeyAutomatically: true,
 *     regenerationPeriod: "P1D",
 * }, {
 *     dependsOn: [exampleAssignment],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_azuread as azuread
 * current = azure.core.get_client_config()
 * test = azuread.get_service_principal(application_id="cfa8b339-82a2-471a-a3c9-0fc0be7a4093")
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="storageaccountname",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * example_key_vault = azure.keyvault.KeyVault("example",
 *     name="keyvaultname",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     tenant_id=current.tenant_id,
 *     sku_name="standard",
 *     access_policies=[{
 *         "tenant_id": current.tenant_id,
 *         "object_id": current.object_id,
 *         "secret_permissions": [
 *             "Get",
 *             "Delete",
 *         ],
 *         "storage_permissions": [
 *             "Get",
 *             "List",
 *             "Set",
 *             "SetSAS",
 *             "GetSAS",
 *             "DeleteSAS",
 *             "Update",
 *             "RegenerateKey",
 *         ],
 *     }])
 * example_assignment = azure.authorization.Assignment("example",
 *     scope=example_account.id,
 *     role_definition_name="Storage Account Key Operator Service Role",
 *     principal_id=test.id)
 * example_managed_storage_account = azure.keyvault.ManagedStorageAccount("example",
 *     name="examplemanagedstorage",
 *     key_vault_id=example_key_vault.id,
 *     storage_account_id=example_account.id,
 *     storage_account_key="key1",
 *     regenerate_key_automatically=True,
 *     regeneration_period="P1D",
 *     opts = pulumi.ResourceOptions(depends_on=[example_assignment]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using AzureAD = Pulumi.AzureAD;
 * return await Deployment.RunAsync(() =>
 * {
 *     var current = Azure.Core.GetClientConfig.Invoke();
 *     var test = AzureAD.GetServicePrincipal.Invoke(new()
 *     {
 *         ApplicationId = "cfa8b339-82a2-471a-a3c9-0fc0be7a4093",
 *     });
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "storageaccountname",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var exampleKeyVault = new Azure.KeyVault.KeyVault("example", new()
 *     {
 *         Name = "keyvaultname",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *         SkuName = "standard",
 *         AccessPolicies = new[]
 *         {
 *             new Azure.KeyVault.Inputs.KeyVaultAccessPolicyArgs
 *             {
 *                 TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *                 ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *                 SecretPermissions = new[]
 *                 {
 *                     "Get",
 *                     "Delete",
 *                 },
 *                 StoragePermissions = new[]
 *                 {
 *                     "Get",
 *                     "List",
 *                     "Set",
 *                     "SetSAS",
 *                     "GetSAS",
 *                     "DeleteSAS",
 *                     "Update",
 *                     "RegenerateKey",
 *                 },
 *             },
 *         },
 *     });
 *     var exampleAssignment = new Azure.Authorization.Assignment("example", new()
 *     {
 *         Scope = exampleAccount.Id,
 *         RoleDefinitionName = "Storage Account Key Operator Service Role",
 *         PrincipalId = test.Apply(getServicePrincipalResult => getServicePrincipalResult.Id),
 *     });
 *     var exampleManagedStorageAccount = new Azure.KeyVault.ManagedStorageAccount("example", new()
 *     {
 *         Name = "examplemanagedstorage",
 *         KeyVaultId = exampleKeyVault.Id,
 *         StorageAccountId = exampleAccount.Id,
 *         StorageAccountKey = "key1",
 *         RegenerateKeyAutomatically = true,
 *         RegenerationPeriod = "P1D",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             exampleAssignment,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/keyvault"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
 * 	"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
 * 		}
 * 		test, err := azuread.LookupServicePrincipal(ctx, &azuread.LookupServicePrincipalArgs{
 * 			ApplicationId: pulumi.StringRef("cfa8b339-82a2-471a-a3c9-0fc0be7a4093"),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("storageaccountname"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleKeyVault, err := keyvault.NewKeyVault(ctx, "example", &keyvault.KeyVaultArgs{
 * 			Name:              pulumi.String("keyvaultname"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			TenantId:          pulumi.String(current.TenantId),
 * 			SkuName:           pulumi.String("standard"),
 * 			AccessPolicies: keyvault.KeyVaultAccessPolicyArray{
 * 				&keyvault.KeyVaultAccessPolicyArgs{
 * 					TenantId: pulumi.String(current.TenantId),
 * 					ObjectId: pulumi.String(current.ObjectId),
 * 					SecretPermissions: pulumi.StringArray{
 * 						pulumi.String("Get"),
 * 						pulumi.String("Delete"),
 * 					},
 * 					StoragePermissions: pulumi.StringArray{
 * 						pulumi.String("Get"),
 * 						pulumi.String("List"),
 * 						pulumi.String("Set"),
 * 						pulumi.String("SetSAS"),
 * 						pulumi.String("GetSAS"),
 * 						pulumi.String("DeleteSAS"),
 * 						pulumi.String("Update"),
 * 						pulumi.String("RegenerateKey"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAssignment, err := authorization.NewAssignment(ctx, "example", &authorization.AssignmentArgs{
 * 			Scope:              exampleAccount.ID(),
 * 			RoleDefinitionName: pulumi.String("Storage Account Key Operator Service Role"),
 * 			PrincipalId:        pulumi.String(test.Id),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = keyvault.NewManagedStorageAccount(ctx, "example", &keyvault.ManagedStorageAccountArgs{
 * 			Name:                       pulumi.String("examplemanagedstorage"),
 * 			KeyVaultId:                 exampleKeyVault.ID(),
 * 			StorageAccountId:           exampleAccount.ID(),
 * 			StorageAccountKey:          pulumi.String("key1"),
 * 			RegenerateKeyAutomatically: pulumi.Bool(true),
 * 			RegenerationPeriod:         pulumi.String("P1D"),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			exampleAssignment,
 * 		}))
 * 		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.azuread.AzureadFunctions;
 * import com.pulumi.azuread.inputs.GetServicePrincipalArgs;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.keyvault.KeyVault;
 * import com.pulumi.azure.keyvault.KeyVaultArgs;
 * import com.pulumi.azure.keyvault.inputs.KeyVaultAccessPolicyArgs;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * import com.pulumi.azure.keyvault.ManagedStorageAccount;
 * import com.pulumi.azure.keyvault.ManagedStorageAccountArgs;
 * 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 test = AzureadFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
 *             .applicationId("cfa8b339-82a2-471a-a3c9-0fc0be7a4093")
 *             .build());
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("storageaccountname")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
 *             .name("keyvaultname")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .skuName("standard")
 *             .accessPolicies(KeyVaultAccessPolicyArgs.builder()
 *                 .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *                 .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *                 .secretPermissions(
 *                     "Get",
 *                     "Delete")
 *                 .storagePermissions(
 *                     "Get",
 *                     "List",
 *                     "Set",
 *                     "SetSAS",
 *                     "GetSAS",
 *                     "DeleteSAS",
 *                     "Update",
 *                     "RegenerateKey")
 *                 .build())
 *             .build());
 *         var exampleAssignment = new Assignment("exampleAssignment", AssignmentArgs.builder()
 *             .scope(exampleAccount.id())
 *             .roleDefinitionName("Storage Account Key Operator Service Role")
 *             .principalId(test.applyValue(getServicePrincipalResult -> getServicePrincipalResult.id()))
 *             .build());
 *         var exampleManagedStorageAccount = new ManagedStorageAccount("exampleManagedStorageAccount", ManagedStorageAccountArgs.builder()
 *             .name("examplemanagedstorage")
 *             .keyVaultId(exampleKeyVault.id())
 *             .storageAccountId(exampleAccount.id())
 *             .storageAccountKey("key1")
 *             .regenerateKeyAutomatically(true)
 *             .regenerationPeriod("P1D")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(exampleAssignment)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: storageaccountname
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   exampleKeyVault:
 *     type: azure:keyvault:KeyVault
 *     name: example
 *     properties:
 *       name: keyvaultname
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       tenantId: ${current.tenantId}
 *       skuName: standard
 *       accessPolicies:
 *         - tenantId: ${current.tenantId}
 *           objectId: ${current.objectId}
 *           secretPermissions:
 *             - Get
 *             - Delete
 *           storagePermissions:
 *             - Get
 *             - List
 *             - Set
 *             - SetSAS
 *             - GetSAS
 *             - DeleteSAS
 *             - Update
 *             - RegenerateKey
 *   exampleAssignment:
 *     type: azure:authorization:Assignment
 *     name: example
 *     properties:
 *       scope: ${exampleAccount.id}
 *       roleDefinitionName: Storage Account Key Operator Service Role
 *       principalId: ${test.id}
 *   exampleManagedStorageAccount:
 *     type: azure:keyvault:ManagedStorageAccount
 *     name: example
 *     properties:
 *       name: examplemanagedstorage
 *       keyVaultId: ${exampleKeyVault.id}
 *       storageAccountId: ${exampleAccount.id}
 *       storageAccountKey: key1
 *       regenerateKeyAutomatically: true
 *       regenerationPeriod: P1D
 *     options:
 *       dependson:
 *         - ${exampleAssignment}
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 *   test:
 *     fn::invoke:
 *       Function: azuread:getServicePrincipal
 *       Arguments:
 *         applicationId: cfa8b339-82a2-471a-a3c9-0fc0be7a4093
 * ```
 * 
 * ## Import
 * Key Vault Managed Storage Accounts can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:keyvault/managedStorageAccount:ManagedStorageAccount example https://example-keyvault.vault.azure.net/storage/exampleStorageAcc01
 * ```
 */
public class ManagedStorageAccount internal constructor(
    override val javaResource: com.pulumi.azure.keyvault.ManagedStorageAccount,
) : KotlinCustomResource(javaResource, ManagedStorageAccountMapper) {
    /**
     * The ID of the Key Vault where the Managed Storage Account should be created. Changing this forces a new resource to be created.
     */
    public val keyVaultId: Output
        get() = javaResource.keyVaultId().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Key Vault Managed Storage Account. Changing this forces a new Key Vault Managed Storage Account to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Should Storage Account access key be regenerated periodically?
     * > **NOTE:** Azure Key Vault application needs to have access to Storage Account for auto regeneration to work. Example can be found above.
     */
    public val regenerateKeyAutomatically: Output?
        get() = javaResource.regenerateKeyAutomatically().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * How often Storage Account access key should be regenerated. Value needs to be in [ISO 8601 duration format](https://en.wikipedia.org/wiki/ISO_8601#Durations).
     */
    public val regenerationPeriod: Output?
        get() = javaResource.regenerationPeriod().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the Storage Account.
     */
    public val storageAccountId: Output
        get() = javaResource.storageAccountId().applyValue({ args0 -> args0 })

    /**
     * Which Storage Account access key that is managed by Key Vault. Possible values are `key1` and `key2`.
     */
    public val storageAccountKey: Output
        get() = javaResource.storageAccountKey().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags which should be assigned to the Key Vault Managed Storage Account. Changing this forces a new resource to be created.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object ManagedStorageAccountMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.keyvault.ManagedStorageAccount::class == javaResource::class

    override fun map(javaResource: Resource): ManagedStorageAccount =
        ManagedStorageAccount(javaResource as com.pulumi.azure.keyvault.ManagedStorageAccount)
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy