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

com.pulumi.azure.dataprotection.BackupInstanceKubernetesCluster Maven / Gradle / Ivy

Go to download

A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.

There is a newer version: 6.10.0-alpha.1731737215
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.dataprotection;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.dataprotection.BackupInstanceKubernetesClusterArgs;
import com.pulumi.azure.dataprotection.inputs.BackupInstanceKubernetesClusterState;
import com.pulumi.azure.dataprotection.outputs.BackupInstanceKubernetesClusterBackupDatasourceParameters;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages a Backup Instance to back up a Kubernetes Cluster.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * 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.dataprotection.BackupVault;
 * import com.pulumi.azure.dataprotection.BackupVaultArgs;
 * import com.pulumi.azure.dataprotection.inputs.BackupVaultIdentityArgs;
 * import com.pulumi.azure.containerservice.KubernetesCluster;
 * import com.pulumi.azure.containerservice.KubernetesClusterArgs;
 * import com.pulumi.azure.containerservice.inputs.KubernetesClusterDefaultNodePoolArgs;
 * import com.pulumi.azure.containerservice.inputs.KubernetesClusterIdentityArgs;
 * import com.pulumi.azure.containerservice.ClusterTrustedAccessRoleBinding;
 * import com.pulumi.azure.containerservice.ClusterTrustedAccessRoleBindingArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.storage.Container;
 * import com.pulumi.azure.storage.ContainerArgs;
 * import com.pulumi.azure.containerservice.KubernetesClusterExtension;
 * import com.pulumi.azure.containerservice.KubernetesClusterExtensionArgs;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * import com.pulumi.azure.dataprotection.BackupPolicyKubernetesCluster;
 * import com.pulumi.azure.dataprotection.BackupPolicyKubernetesClusterArgs;
 * import com.pulumi.azure.dataprotection.inputs.BackupPolicyKubernetesClusterRetentionRuleArgs;
 * import com.pulumi.azure.dataprotection.inputs.BackupPolicyKubernetesClusterRetentionRuleCriteriaArgs;
 * import com.pulumi.azure.dataprotection.inputs.BackupPolicyKubernetesClusterDefaultRetentionRuleArgs;
 * import com.pulumi.azure.dataprotection.BackupInstanceKubernetesCluster;
 * import com.pulumi.azure.dataprotection.BackupInstanceKubernetesClusterArgs;
 * import com.pulumi.azure.dataprotection.inputs.BackupInstanceKubernetesClusterBackupDatasourceParametersArgs;
 * 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();
 * 
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example")
 *             .location("West Europe")
 *             .build());
 * 
 *         var snap = new ResourceGroup("snap", ResourceGroupArgs.builder()
 *             .name("example-snap")
 *             .location("West Europe")
 *             .build());
 * 
 *         var exampleBackupVault = new BackupVault("exampleBackupVault", BackupVaultArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .datastoreType("VaultStore")
 *             .redundancy("LocallyRedundant")
 *             .identity(BackupVaultIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .build());
 * 
 *         var exampleKubernetesCluster = new KubernetesCluster("exampleKubernetesCluster", KubernetesClusterArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .dnsPrefix("dns")
 *             .defaultNodePool(KubernetesClusterDefaultNodePoolArgs.builder()
 *                 .name("default")
 *                 .nodeCount(1)
 *                 .vmSize("Standard_DS2_v2")
 *                 .hostEncryptionEnabled(true)
 *                 .build())
 *             .identity(KubernetesClusterIdentityArgs.builder()
 *                 .type("SystemAssigned")
 *                 .build())
 *             .build());
 * 
 *         var aksClusterTrustedAccess = new ClusterTrustedAccessRoleBinding("aksClusterTrustedAccess", ClusterTrustedAccessRoleBindingArgs.builder()
 *             .kubernetesClusterId(exampleKubernetesCluster.id())
 *             .name("example")
 *             .roles("Microsoft.DataProtection/backupVaults/backup-operator")
 *             .sourceResourceId(exampleBackupVault.id())
 *             .build());
 * 
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 * 
 *         var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
 *             .name("example")
 *             .storageAccountName(exampleAccount.name())
 *             .containerAccessType("private")
 *             .build());
 * 
 *         var exampleKubernetesClusterExtension = new KubernetesClusterExtension("exampleKubernetesClusterExtension", KubernetesClusterExtensionArgs.builder()
 *             .name("example")
 *             .clusterId(exampleKubernetesCluster.id())
 *             .extensionType("Microsoft.DataProtection.Kubernetes")
 *             .releaseTrain("stable")
 *             .releaseNamespace("dataprotection-microsoft")
 *             .configurationSettings(Map.ofEntries(
 *                 Map.entry("configuration.backupStorageLocation.bucket", exampleContainer.name()),
 *                 Map.entry("configuration.backupStorageLocation.config.resourceGroup", example.name()),
 *                 Map.entry("configuration.backupStorageLocation.config.storageAccount", exampleAccount.name()),
 *                 Map.entry("configuration.backupStorageLocation.config.subscriptionId", current.applyValue(getClientConfigResult -> getClientConfigResult.subscriptionId())),
 *                 Map.entry("credentials.tenantId", current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             ))
 *             .build());
 * 
 *         var testExtensionAndStorageAccountPermission = new Assignment("testExtensionAndStorageAccountPermission", AssignmentArgs.builder()
 *             .scope(exampleAccount.id())
 *             .roleDefinitionName("Storage Account Contributor")
 *             .principalId(exampleKubernetesClusterExtension.aksAssignedIdentities().applyValue(aksAssignedIdentities -> aksAssignedIdentities[0].principalId()))
 *             .build());
 * 
 *         var testVaultMsiReadOnCluster = new Assignment("testVaultMsiReadOnCluster", AssignmentArgs.builder()
 *             .scope(exampleKubernetesCluster.id())
 *             .roleDefinitionName("Reader")
 *             .principalId(exampleBackupVault.identity().applyValue(identity -> identity.principalId()))
 *             .build());
 * 
 *         var testVaultMsiReadOnSnapRg = new Assignment("testVaultMsiReadOnSnapRg", AssignmentArgs.builder()
 *             .scope(snap.id())
 *             .roleDefinitionName("Reader")
 *             .principalId(exampleBackupVault.identity().applyValue(identity -> identity.principalId()))
 *             .build());
 * 
 *         var testVaultMsiSnapshotContributorOnSnapRg = new Assignment("testVaultMsiSnapshotContributorOnSnapRg", AssignmentArgs.builder()
 *             .scope(snap.id())
 *             .roleDefinitionName("Disk Snapshot Contributor")
 *             .principalId(exampleBackupVault.identity().applyValue(identity -> identity.principalId()))
 *             .build());
 * 
 *         var testVaultDataOperatorOnSnapRg = new Assignment("testVaultDataOperatorOnSnapRg", AssignmentArgs.builder()
 *             .scope(snap.id())
 *             .roleDefinitionName("Data Operator for Managed Disks")
 *             .principalId(exampleBackupVault.identity().applyValue(identity -> identity.principalId()))
 *             .build());
 * 
 *         var testVaultDataContributorOnStorage = new Assignment("testVaultDataContributorOnStorage", AssignmentArgs.builder()
 *             .scope(exampleAccount.id())
 *             .roleDefinitionName("Storage Blob Data Contributor")
 *             .principalId(exampleBackupVault.identity().applyValue(identity -> identity.principalId()))
 *             .build());
 * 
 *         var testClusterMsiContributorOnSnapRg = new Assignment("testClusterMsiContributorOnSnapRg", AssignmentArgs.builder()
 *             .scope(snap.id())
 *             .roleDefinitionName("Contributor")
 *             .principalId(exampleKubernetesCluster.identity().applyValue(identity -> identity.principalId()))
 *             .build());
 * 
 *         var exampleBackupPolicyKubernetesCluster = new BackupPolicyKubernetesCluster("exampleBackupPolicyKubernetesCluster", BackupPolicyKubernetesClusterArgs.builder()
 *             .name("example")
 *             .resourceGroupName(example.name())
 *             .vaultName(exampleBackupVault.name())
 *             .backupRepeatingTimeIntervals("R/2023-05-23T02:30:00+00:00/P1W")
 *             .retentionRules(BackupPolicyKubernetesClusterRetentionRuleArgs.builder()
 *                 .name("Daily")
 *                 .priority(25)
 *                 .lifeCycles(BackupPolicyKubernetesClusterRetentionRuleLifeCycleArgs.builder()
 *                     .duration("P84D")
 *                     .dataStoreType("OperationalStore")
 *                     .build())
 *                 .criteria(BackupPolicyKubernetesClusterRetentionRuleCriteriaArgs.builder()
 *                     .daysOfWeeks("Thursday")
 *                     .monthsOfYears("November")
 *                     .weeksOfMonths("First")
 *                     .scheduledBackupTimes("2023-05-23T02:30:00Z")
 *                     .build())
 *                 .build())
 *             .defaultRetentionRule(BackupPolicyKubernetesClusterDefaultRetentionRuleArgs.builder()
 *                 .lifeCycles(BackupPolicyKubernetesClusterDefaultRetentionRuleLifeCycleArgs.builder()
 *                     .duration("P14D")
 *                     .dataStoreType("OperationalStore")
 *                     .build())
 *                 .build())
 *             .build());
 * 
 *         var exampleBackupInstanceKubernetesCluster = new BackupInstanceKubernetesCluster("exampleBackupInstanceKubernetesCluster", BackupInstanceKubernetesClusterArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .vaultId(exampleBackupVault.id())
 *             .kubernetesClusterId(exampleKubernetesCluster.id())
 *             .snapshotResourceGroupName(snap.name())
 *             .backupPolicyId(exampleBackupPolicyKubernetesCluster.id())
 *             .backupDatasourceParameters(BackupInstanceKubernetesClusterBackupDatasourceParametersArgs.builder()
 *                 .excludedNamespaces("test-excluded-namespaces")
 *                 .excludedResourceTypes("exvolumesnapshotcontents.snapshot.storage.k8s.io")
 *                 .clusterScopedResourcesEnabled(true)
 *                 .includedNamespaces("test-included-namespaces")
 *                 .includedResourceTypes("involumesnapshotcontents.snapshot.storage.k8s.io")
 *                 .labelSelectors("kubernetes.io/metadata.name:test")
 *                 .volumeSnapshotEnabled(true)
 *                 .build())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(                
 *                     testExtensionAndStorageAccountPermission,
 *                     testVaultMsiReadOnCluster,
 *                     testVaultMsiReadOnSnapRg,
 *                     testClusterMsiContributorOnSnapRg,
 *                     testVaultMsiSnapshotContributorOnSnapRg,
 *                     testVaultDataOperatorOnSnapRg,
 *                     testVaultDataContributorOnStorage)
 *                 .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Backup Instance Kubernetes Cluster can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:dataprotection/backupInstanceKubernetesCluster:BackupInstanceKubernetesCluster example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataProtection/backupVaults/vault1/backupInstances/backupInstance1 * ``` * */ @ResourceType(type="azure:dataprotection/backupInstanceKubernetesCluster:BackupInstanceKubernetesCluster") public class BackupInstanceKubernetesCluster extends com.pulumi.resources.CustomResource { /** * A `backup_datasource_parameters` block as defined below. * */ @Export(name="backupDatasourceParameters", refs={BackupInstanceKubernetesClusterBackupDatasourceParameters.class}, tree="[0]") private Output backupDatasourceParameters; /** * @return A `backup_datasource_parameters` block as defined below. * */ public Output> backupDatasourceParameters() { return Codegen.optional(this.backupDatasourceParameters); } /** * The ID of the Backup Policy. Changing this forces a new resource to be created. * */ @Export(name="backupPolicyId", refs={String.class}, tree="[0]") private Output backupPolicyId; /** * @return The ID of the Backup Policy. Changing this forces a new resource to be created. * */ public Output backupPolicyId() { return this.backupPolicyId; } /** * The ID of the Kubernetes Cluster. Changing this forces a new resource to be created. * */ @Export(name="kubernetesClusterId", refs={String.class}, tree="[0]") private Output kubernetesClusterId; /** * @return The ID of the Kubernetes Cluster. Changing this forces a new resource to be created. * */ public Output kubernetesClusterId() { return this.kubernetesClusterId; } /** * The location of the Backup Instance Kubernetes Cluster. Changing this forces a new resource to be created. * */ @Export(name="location", refs={String.class}, tree="[0]") private Output location; /** * @return The location of the Backup Instance Kubernetes Cluster. Changing this forces a new resource to be created. * */ public Output location() { return this.location; } /** * The name which should be used for this Backup Instance Kubernetes Cluster. Changing this forces a new resource to be created. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name which should be used for this Backup Instance Kubernetes Cluster. Changing this forces a new resource to be created. * */ public Output name() { return this.name; } /** * The name of the Resource Group where snapshots are stored. Changing this forces a new resource to be created. * */ @Export(name="snapshotResourceGroupName", refs={String.class}, tree="[0]") private Output snapshotResourceGroupName; /** * @return The name of the Resource Group where snapshots are stored. Changing this forces a new resource to be created. * */ public Output snapshotResourceGroupName() { return this.snapshotResourceGroupName; } /** * The ID of the Backup Vault within which the Backup Instance Kubernetes Cluster should exist. Changing this forces a new resource to be created. * */ @Export(name="vaultId", refs={String.class}, tree="[0]") private Output vaultId; /** * @return The ID of the Backup Vault within which the Backup Instance Kubernetes Cluster should exist. Changing this forces a new resource to be created. * */ public Output vaultId() { return this.vaultId; } /** * * @param name The _unique_ name of the resulting resource. */ public BackupInstanceKubernetesCluster(java.lang.String name) { this(name, BackupInstanceKubernetesClusterArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public BackupInstanceKubernetesCluster(java.lang.String name, BackupInstanceKubernetesClusterArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public BackupInstanceKubernetesCluster(java.lang.String name, BackupInstanceKubernetesClusterArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:dataprotection/backupInstanceKubernetesCluster:BackupInstanceKubernetesCluster", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private BackupInstanceKubernetesCluster(java.lang.String name, Output id, @Nullable BackupInstanceKubernetesClusterState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:dataprotection/backupInstanceKubernetesCluster:BackupInstanceKubernetesCluster", name, state, makeResourceOptions(options, id), false); } private static BackupInstanceKubernetesClusterArgs makeArgs(BackupInstanceKubernetesClusterArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? BackupInstanceKubernetesClusterArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state * @param options Optional settings to control the behavior of the CustomResource. */ public static BackupInstanceKubernetesCluster get(java.lang.String name, Output id, @Nullable BackupInstanceKubernetesClusterState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new BackupInstanceKubernetesCluster(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy