1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. hbr
  5. ReplicationVault
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.hbr.ReplicationVault

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    Provides a Hybrid Backup Recovery (HBR) Replication Vault resource.

    For information about Hybrid Backup Recovery (HBR) Replication Vault and how to use it, see What is Replication Vault.

    NOTE: Available in v1.152.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const sourceRegion = config.get("sourceRegion") || "cn-hangzhou";
    const source = new alicloud.Provider("source", {region: sourceRegion});
    const defaultReplicationVaultRegions = alicloud.hbr.getReplicationVaultRegions({});
    const replication = new alicloud.Provider("replication", {region: defaultReplicationVaultRegions.then(defaultReplicationVaultRegions => defaultReplicationVaultRegions.regions?.[0]?.replicationRegionId)});
    const defaultRandomInteger = new random.RandomInteger("defaultRandomInteger", {
        min: 10000,
        max: 99999,
    });
    const defaultVault = new alicloud.hbr.Vault("defaultVault", {vaultName: pulumi.interpolate`terraform-example-${defaultRandomInteger.result}`}, {
        provider: alicloud.source,
    });
    const defaultReplicationVault = new alicloud.hbr.ReplicationVault("defaultReplicationVault", {
        replicationSourceRegionId: sourceRegion,
        replicationSourceVaultId: defaultVault.id,
        vaultName: "terraform-example",
        vaultStorageClass: "STANDARD",
        description: "terraform-example",
    }, {
        provider: alicloud.replication,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    source_region = config.get("sourceRegion")
    if source_region is None:
        source_region = "cn-hangzhou"
    source = alicloud.Provider("source", region=source_region)
    default_replication_vault_regions = alicloud.hbr.get_replication_vault_regions()
    replication = alicloud.Provider("replication", region=default_replication_vault_regions.regions[0].replication_region_id)
    default_random_integer = random.RandomInteger("defaultRandomInteger",
        min=10000,
        max=99999)
    default_vault = alicloud.hbr.Vault("defaultVault", vault_name=default_random_integer.result.apply(lambda result: f"terraform-example-{result}"),
    opts=pulumi.ResourceOptions(provider=alicloud["source"]))
    default_replication_vault = alicloud.hbr.ReplicationVault("defaultReplicationVault",
        replication_source_region_id=source_region,
        replication_source_vault_id=default_vault.id,
        vault_name="terraform-example",
        vault_storage_class="STANDARD",
        description="terraform-example",
        opts=pulumi.ResourceOptions(provider=alicloud["replication"]))
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/hbr"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		sourceRegion := "cn-hangzhou"
    		if param := cfg.Get("sourceRegion"); param != "" {
    			sourceRegion = param
    		}
    		_, err := alicloud.NewProvider(ctx, "source", &alicloud.ProviderArgs{
    			Region: pulumi.String(sourceRegion),
    		})
    		if err != nil {
    			return err
    		}
    		defaultReplicationVaultRegions, err := hbr.GetReplicationVaultRegions(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		_, err = alicloud.NewProvider(ctx, "replication", &alicloud.ProviderArgs{
    			Region: pulumi.String(defaultReplicationVaultRegions.Regions[0].ReplicationRegionId),
    		})
    		if err != nil {
    			return err
    		}
    		defaultRandomInteger, err := random.NewRandomInteger(ctx, "defaultRandomInteger", &random.RandomIntegerArgs{
    			Min: pulumi.Int(10000),
    			Max: pulumi.Int(99999),
    		})
    		if err != nil {
    			return err
    		}
    		defaultVault, err := hbr.NewVault(ctx, "defaultVault", &hbr.VaultArgs{
    			VaultName: defaultRandomInteger.Result.ApplyT(func(result int) (string, error) {
    				return fmt.Sprintf("terraform-example-%v", result), nil
    			}).(pulumi.StringOutput),
    		}, pulumi.Provider(alicloud.Source))
    		if err != nil {
    			return err
    		}
    		_, err = hbr.NewReplicationVault(ctx, "defaultReplicationVault", &hbr.ReplicationVaultArgs{
    			ReplicationSourceRegionId: pulumi.String(sourceRegion),
    			ReplicationSourceVaultId:  defaultVault.ID(),
    			VaultName:                 pulumi.String("terraform-example"),
    			VaultStorageClass:         pulumi.String("STANDARD"),
    			Description:               pulumi.String("terraform-example"),
    		}, pulumi.Provider(alicloud.Replication))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var sourceRegion = config.Get("sourceRegion") ?? "cn-hangzhou";
        var source = new AliCloud.Provider("source", new()
        {
            Region = sourceRegion,
        });
    
        var defaultReplicationVaultRegions = AliCloud.Hbr.GetReplicationVaultRegions.Invoke();
    
        var replication = new AliCloud.Provider("replication", new()
        {
            Region = defaultReplicationVaultRegions.Apply(getReplicationVaultRegionsResult => getReplicationVaultRegionsResult.Regions[0]?.ReplicationRegionId),
        });
    
        var defaultRandomInteger = new Random.RandomInteger("defaultRandomInteger", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var defaultVault = new AliCloud.Hbr.Vault("defaultVault", new()
        {
            VaultName = defaultRandomInteger.Result.Apply(result => $"terraform-example-{result}"),
        }, new CustomResourceOptions
        {
            Provider = alicloud.Source,
        });
    
        var defaultReplicationVault = new AliCloud.Hbr.ReplicationVault("defaultReplicationVault", new()
        {
            ReplicationSourceRegionId = sourceRegion,
            ReplicationSourceVaultId = defaultVault.Id,
            VaultName = "terraform-example",
            VaultStorageClass = "STANDARD",
            Description = "terraform-example",
        }, new CustomResourceOptions
        {
            Provider = alicloud.Replication,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.Provider;
    import com.pulumi.alicloud.ProviderArgs;
    import com.pulumi.alicloud.hbr.HbrFunctions;
    import com.pulumi.alicloud.hbr.inputs.GetReplicationVaultRegionsArgs;
    import com.pulumi.random.RandomInteger;
    import com.pulumi.random.RandomIntegerArgs;
    import com.pulumi.alicloud.hbr.Vault;
    import com.pulumi.alicloud.hbr.VaultArgs;
    import com.pulumi.alicloud.hbr.ReplicationVault;
    import com.pulumi.alicloud.hbr.ReplicationVaultArgs;
    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 config = ctx.config();
            final var sourceRegion = config.get("sourceRegion").orElse("cn-hangzhou");
            var source = new Provider("source", ProviderArgs.builder()        
                .region(sourceRegion)
                .build());
    
            final var defaultReplicationVaultRegions = HbrFunctions.getReplicationVaultRegions();
    
            var replication = new Provider("replication", ProviderArgs.builder()        
                .region(defaultReplicationVaultRegions.applyValue(getReplicationVaultRegionsResult -> getReplicationVaultRegionsResult.regions()[0].replicationRegionId()))
                .build());
    
            var defaultRandomInteger = new RandomInteger("defaultRandomInteger", RandomIntegerArgs.builder()        
                .min(10000)
                .max(99999)
                .build());
    
            var defaultVault = new Vault("defaultVault", VaultArgs.builder()        
                .vaultName(defaultRandomInteger.result().applyValue(result -> String.format("terraform-example-%s", result)))
                .build(), CustomResourceOptions.builder()
                    .provider(alicloud.source())
                    .build());
    
            var defaultReplicationVault = new ReplicationVault("defaultReplicationVault", ReplicationVaultArgs.builder()        
                .replicationSourceRegionId(sourceRegion)
                .replicationSourceVaultId(defaultVault.id())
                .vaultName("terraform-example")
                .vaultStorageClass("STANDARD")
                .description("terraform-example")
                .build(), CustomResourceOptions.builder()
                    .provider(alicloud.replication())
                    .build());
    
        }
    }
    
    configuration:
      sourceRegion:
        type: string
        default: cn-hangzhou
    resources:
      source:
        type: pulumi:providers:alicloud
        properties:
          region: ${sourceRegion}
      replication:
        type: pulumi:providers:alicloud
        properties:
          region: ${defaultReplicationVaultRegions.regions[0].replicationRegionId}
      defaultRandomInteger:
        type: random:RandomInteger
        properties:
          min: 10000
          max: 99999
      defaultVault:
        type: alicloud:hbr:Vault
        properties:
          vaultName: terraform-example-${defaultRandomInteger.result}
        options:
          provider: ${alicloud.source}
      defaultReplicationVault:
        type: alicloud:hbr:ReplicationVault
        properties:
          replicationSourceRegionId: ${sourceRegion}
          replicationSourceVaultId: ${defaultVault.id}
          vaultName: terraform-example
          vaultStorageClass: STANDARD
          description: terraform-example
        options:
          provider: ${alicloud.replication}
    variables:
      defaultReplicationVaultRegions:
        fn::invoke:
          Function: alicloud:hbr:getReplicationVaultRegions
          Arguments: {}
    

    Create ReplicationVault Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ReplicationVault(name: string, args: ReplicationVaultArgs, opts?: CustomResourceOptions);
    @overload
    def ReplicationVault(resource_name: str,
                         args: ReplicationVaultArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def ReplicationVault(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         replication_source_region_id: Optional[str] = None,
                         replication_source_vault_id: Optional[str] = None,
                         vault_name: Optional[str] = None,
                         description: Optional[str] = None,
                         vault_storage_class: Optional[str] = None)
    func NewReplicationVault(ctx *Context, name string, args ReplicationVaultArgs, opts ...ResourceOption) (*ReplicationVault, error)
    public ReplicationVault(string name, ReplicationVaultArgs args, CustomResourceOptions? opts = null)
    public ReplicationVault(String name, ReplicationVaultArgs args)
    public ReplicationVault(String name, ReplicationVaultArgs args, CustomResourceOptions options)
    
    type: alicloud:hbr:ReplicationVault
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ReplicationVaultArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ReplicationVaultArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ReplicationVaultArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ReplicationVaultArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ReplicationVaultArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var replicationVaultResource = new AliCloud.Hbr.ReplicationVault("replicationVaultResource", new()
    {
        ReplicationSourceRegionId = "string",
        ReplicationSourceVaultId = "string",
        VaultName = "string",
        Description = "string",
        VaultStorageClass = "string",
    });
    
    example, err := hbr.NewReplicationVault(ctx, "replicationVaultResource", &hbr.ReplicationVaultArgs{
    	ReplicationSourceRegionId: pulumi.String("string"),
    	ReplicationSourceVaultId:  pulumi.String("string"),
    	VaultName:                 pulumi.String("string"),
    	Description:               pulumi.String("string"),
    	VaultStorageClass:         pulumi.String("string"),
    })
    
    var replicationVaultResource = new ReplicationVault("replicationVaultResource", ReplicationVaultArgs.builder()        
        .replicationSourceRegionId("string")
        .replicationSourceVaultId("string")
        .vaultName("string")
        .description("string")
        .vaultStorageClass("string")
        .build());
    
    replication_vault_resource = alicloud.hbr.ReplicationVault("replicationVaultResource",
        replication_source_region_id="string",
        replication_source_vault_id="string",
        vault_name="string",
        description="string",
        vault_storage_class="string")
    
    const replicationVaultResource = new alicloud.hbr.ReplicationVault("replicationVaultResource", {
        replicationSourceRegionId: "string",
        replicationSourceVaultId: "string",
        vaultName: "string",
        description: "string",
        vaultStorageClass: "string",
    });
    
    type: alicloud:hbr:ReplicationVault
    properties:
        description: string
        replicationSourceRegionId: string
        replicationSourceVaultId: string
        vaultName: string
        vaultStorageClass: string
    

    ReplicationVault Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ReplicationVault resource accepts the following input properties:

    ReplicationSourceRegionId string
    The ID of the region where the source vault resides.
    ReplicationSourceVaultId string
    The ID of the source vault.
    VaultName string
    The name of the backup vault. The name must be 1 to 64 characters in length.
    Description string
    The description of the backup vault. The description must be 0 to 255 characters in length.
    VaultStorageClass string
    The storage type of the backup vault. Valid values: STANDARD.
    ReplicationSourceRegionId string
    The ID of the region where the source vault resides.
    ReplicationSourceVaultId string
    The ID of the source vault.
    VaultName string
    The name of the backup vault. The name must be 1 to 64 characters in length.
    Description string
    The description of the backup vault. The description must be 0 to 255 characters in length.
    VaultStorageClass string
    The storage type of the backup vault. Valid values: STANDARD.
    replicationSourceRegionId String
    The ID of the region where the source vault resides.
    replicationSourceVaultId String
    The ID of the source vault.
    vaultName String
    The name of the backup vault. The name must be 1 to 64 characters in length.
    description String
    The description of the backup vault. The description must be 0 to 255 characters in length.
    vaultStorageClass String
    The storage type of the backup vault. Valid values: STANDARD.
    replicationSourceRegionId string
    The ID of the region where the source vault resides.
    replicationSourceVaultId string
    The ID of the source vault.
    vaultName string
    The name of the backup vault. The name must be 1 to 64 characters in length.
    description string
    The description of the backup vault. The description must be 0 to 255 characters in length.
    vaultStorageClass string
    The storage type of the backup vault. Valid values: STANDARD.
    replication_source_region_id str
    The ID of the region where the source vault resides.
    replication_source_vault_id str
    The ID of the source vault.
    vault_name str
    The name of the backup vault. The name must be 1 to 64 characters in length.
    description str
    The description of the backup vault. The description must be 0 to 255 characters in length.
    vault_storage_class str
    The storage type of the backup vault. Valid values: STANDARD.
    replicationSourceRegionId String
    The ID of the region where the source vault resides.
    replicationSourceVaultId String
    The ID of the source vault.
    vaultName String
    The name of the backup vault. The name must be 1 to 64 characters in length.
    description String
    The description of the backup vault. The description must be 0 to 255 characters in length.
    vaultStorageClass String
    The storage type of the backup vault. Valid values: STANDARD.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ReplicationVault resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the resource.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the resource.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the resource.

    Look up Existing ReplicationVault Resource

    Get an existing ReplicationVault resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ReplicationVaultState, opts?: CustomResourceOptions): ReplicationVault
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            replication_source_region_id: Optional[str] = None,
            replication_source_vault_id: Optional[str] = None,
            status: Optional[str] = None,
            vault_name: Optional[str] = None,
            vault_storage_class: Optional[str] = None) -> ReplicationVault
    func GetReplicationVault(ctx *Context, name string, id IDInput, state *ReplicationVaultState, opts ...ResourceOption) (*ReplicationVault, error)
    public static ReplicationVault Get(string name, Input<string> id, ReplicationVaultState? state, CustomResourceOptions? opts = null)
    public static ReplicationVault get(String name, Output<String> id, ReplicationVaultState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Description string
    The description of the backup vault. The description must be 0 to 255 characters in length.
    ReplicationSourceRegionId string
    The ID of the region where the source vault resides.
    ReplicationSourceVaultId string
    The ID of the source vault.
    Status string
    The status of the resource.
    VaultName string
    The name of the backup vault. The name must be 1 to 64 characters in length.
    VaultStorageClass string
    The storage type of the backup vault. Valid values: STANDARD.
    Description string
    The description of the backup vault. The description must be 0 to 255 characters in length.
    ReplicationSourceRegionId string
    The ID of the region where the source vault resides.
    ReplicationSourceVaultId string
    The ID of the source vault.
    Status string
    The status of the resource.
    VaultName string
    The name of the backup vault. The name must be 1 to 64 characters in length.
    VaultStorageClass string
    The storage type of the backup vault. Valid values: STANDARD.
    description String
    The description of the backup vault. The description must be 0 to 255 characters in length.
    replicationSourceRegionId String
    The ID of the region where the source vault resides.
    replicationSourceVaultId String
    The ID of the source vault.
    status String
    The status of the resource.
    vaultName String
    The name of the backup vault. The name must be 1 to 64 characters in length.
    vaultStorageClass String
    The storage type of the backup vault. Valid values: STANDARD.
    description string
    The description of the backup vault. The description must be 0 to 255 characters in length.
    replicationSourceRegionId string
    The ID of the region where the source vault resides.
    replicationSourceVaultId string
    The ID of the source vault.
    status string
    The status of the resource.
    vaultName string
    The name of the backup vault. The name must be 1 to 64 characters in length.
    vaultStorageClass string
    The storage type of the backup vault. Valid values: STANDARD.
    description str
    The description of the backup vault. The description must be 0 to 255 characters in length.
    replication_source_region_id str
    The ID of the region where the source vault resides.
    replication_source_vault_id str
    The ID of the source vault.
    status str
    The status of the resource.
    vault_name str
    The name of the backup vault. The name must be 1 to 64 characters in length.
    vault_storage_class str
    The storage type of the backup vault. Valid values: STANDARD.
    description String
    The description of the backup vault. The description must be 0 to 255 characters in length.
    replicationSourceRegionId String
    The ID of the region where the source vault resides.
    replicationSourceVaultId String
    The ID of the source vault.
    status String
    The status of the resource.
    vaultName String
    The name of the backup vault. The name must be 1 to 64 characters in length.
    vaultStorageClass String
    The storage type of the backup vault. Valid values: STANDARD.

    Import

    Hybrid Backup Recovery (HBR) Replication Vault can be imported using the id, e.g.

    $ pulumi import alicloud:hbr/replicationVault:ReplicationVault example <id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi