1. Packages
  2. Azure Classic
  3. API Docs
  4. siterecovery
  5. ProtectionContainer

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

azure.siterecovery.ProtectionContainer

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Manages a Azure Site Recovery protection container. Protection containers serve as containers for replicated VMs and belong to a single region / recovery fabric. Protection containers can contain more than one replicated VM. To replicate a VM, a container must exist in both the source and target Azure regions.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const primary = new azure.core.ResourceGroup("primary", {
        name: "tfex-network-mapping-primary",
        location: "West US",
    });
    const secondary = new azure.core.ResourceGroup("secondary", {
        name: "tfex-network-mapping-secondary",
        location: "East US",
    });
    const vault = new azure.recoveryservices.Vault("vault", {
        name: "example-recovery-vault",
        location: secondary.location,
        resourceGroupName: secondary.name,
        sku: "Standard",
    });
    const fabric = new azure.siterecovery.Fabric("fabric", {
        name: "primary-fabric",
        resourceGroupName: secondary.name,
        recoveryVaultName: vault.name,
        location: primary.location,
    });
    const protection_container = new azure.siterecovery.ProtectionContainer("protection-container", {
        name: "protection-container",
        resourceGroupName: secondary.name,
        recoveryVaultName: vault.name,
        recoveryFabricName: fabric.name,
    });
    
    import pulumi
    import pulumi_azure as azure
    
    primary = azure.core.ResourceGroup("primary",
        name="tfex-network-mapping-primary",
        location="West US")
    secondary = azure.core.ResourceGroup("secondary",
        name="tfex-network-mapping-secondary",
        location="East US")
    vault = azure.recoveryservices.Vault("vault",
        name="example-recovery-vault",
        location=secondary.location,
        resource_group_name=secondary.name,
        sku="Standard")
    fabric = azure.siterecovery.Fabric("fabric",
        name="primary-fabric",
        resource_group_name=secondary.name,
        recovery_vault_name=vault.name,
        location=primary.location)
    protection_container = azure.siterecovery.ProtectionContainer("protection-container",
        name="protection-container",
        resource_group_name=secondary.name,
        recovery_vault_name=vault.name,
        recovery_fabric_name=fabric.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/recoveryservices"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/siterecovery"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		primary, err := core.NewResourceGroup(ctx, "primary", &core.ResourceGroupArgs{
    			Name:     pulumi.String("tfex-network-mapping-primary"),
    			Location: pulumi.String("West US"),
    		})
    		if err != nil {
    			return err
    		}
    		secondary, err := core.NewResourceGroup(ctx, "secondary", &core.ResourceGroupArgs{
    			Name:     pulumi.String("tfex-network-mapping-secondary"),
    			Location: pulumi.String("East US"),
    		})
    		if err != nil {
    			return err
    		}
    		vault, err := recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
    			Name:              pulumi.String("example-recovery-vault"),
    			Location:          secondary.Location,
    			ResourceGroupName: secondary.Name,
    			Sku:               pulumi.String("Standard"),
    		})
    		if err != nil {
    			return err
    		}
    		fabric, err := siterecovery.NewFabric(ctx, "fabric", &siterecovery.FabricArgs{
    			Name:              pulumi.String("primary-fabric"),
    			ResourceGroupName: secondary.Name,
    			RecoveryVaultName: vault.Name,
    			Location:          primary.Location,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = siterecovery.NewProtectionContainer(ctx, "protection-container", &siterecovery.ProtectionContainerArgs{
    			Name:               pulumi.String("protection-container"),
    			ResourceGroupName:  secondary.Name,
    			RecoveryVaultName:  vault.Name,
    			RecoveryFabricName: fabric.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var primary = new Azure.Core.ResourceGroup("primary", new()
        {
            Name = "tfex-network-mapping-primary",
            Location = "West US",
        });
    
        var secondary = new Azure.Core.ResourceGroup("secondary", new()
        {
            Name = "tfex-network-mapping-secondary",
            Location = "East US",
        });
    
        var vault = new Azure.RecoveryServices.Vault("vault", new()
        {
            Name = "example-recovery-vault",
            Location = secondary.Location,
            ResourceGroupName = secondary.Name,
            Sku = "Standard",
        });
    
        var fabric = new Azure.SiteRecovery.Fabric("fabric", new()
        {
            Name = "primary-fabric",
            ResourceGroupName = secondary.Name,
            RecoveryVaultName = vault.Name,
            Location = primary.Location,
        });
    
        var protection_container = new Azure.SiteRecovery.ProtectionContainer("protection-container", new()
        {
            Name = "protection-container",
            ResourceGroupName = secondary.Name,
            RecoveryVaultName = vault.Name,
            RecoveryFabricName = fabric.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.recoveryservices.Vault;
    import com.pulumi.azure.recoveryservices.VaultArgs;
    import com.pulumi.azure.siterecovery.Fabric;
    import com.pulumi.azure.siterecovery.FabricArgs;
    import com.pulumi.azure.siterecovery.ProtectionContainer;
    import com.pulumi.azure.siterecovery.ProtectionContainerArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var primary = new ResourceGroup("primary", ResourceGroupArgs.builder()
                .name("tfex-network-mapping-primary")
                .location("West US")
                .build());
    
            var secondary = new ResourceGroup("secondary", ResourceGroupArgs.builder()
                .name("tfex-network-mapping-secondary")
                .location("East US")
                .build());
    
            var vault = new Vault("vault", VaultArgs.builder()
                .name("example-recovery-vault")
                .location(secondary.location())
                .resourceGroupName(secondary.name())
                .sku("Standard")
                .build());
    
            var fabric = new Fabric("fabric", FabricArgs.builder()
                .name("primary-fabric")
                .resourceGroupName(secondary.name())
                .recoveryVaultName(vault.name())
                .location(primary.location())
                .build());
    
            var protection_container = new ProtectionContainer("protection-container", ProtectionContainerArgs.builder()
                .name("protection-container")
                .resourceGroupName(secondary.name())
                .recoveryVaultName(vault.name())
                .recoveryFabricName(fabric.name())
                .build());
    
        }
    }
    
    resources:
      primary:
        type: azure:core:ResourceGroup
        properties:
          name: tfex-network-mapping-primary
          location: West US
      secondary:
        type: azure:core:ResourceGroup
        properties:
          name: tfex-network-mapping-secondary
          location: East US
      vault:
        type: azure:recoveryservices:Vault
        properties:
          name: example-recovery-vault
          location: ${secondary.location}
          resourceGroupName: ${secondary.name}
          sku: Standard
      fabric:
        type: azure:siterecovery:Fabric
        properties:
          name: primary-fabric
          resourceGroupName: ${secondary.name}
          recoveryVaultName: ${vault.name}
          location: ${primary.location}
      protection-container:
        type: azure:siterecovery:ProtectionContainer
        properties:
          name: protection-container
          resourceGroupName: ${secondary.name}
          recoveryVaultName: ${vault.name}
          recoveryFabricName: ${fabric.name}
    

    Create ProtectionContainer Resource

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

    Constructor syntax

    new ProtectionContainer(name: string, args: ProtectionContainerArgs, opts?: CustomResourceOptions);
    @overload
    def ProtectionContainer(resource_name: str,
                            args: ProtectionContainerArgs,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProtectionContainer(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            recovery_fabric_name: Optional[str] = None,
                            recovery_vault_name: Optional[str] = None,
                            resource_group_name: Optional[str] = None,
                            name: Optional[str] = None)
    func NewProtectionContainer(ctx *Context, name string, args ProtectionContainerArgs, opts ...ResourceOption) (*ProtectionContainer, error)
    public ProtectionContainer(string name, ProtectionContainerArgs args, CustomResourceOptions? opts = null)
    public ProtectionContainer(String name, ProtectionContainerArgs args)
    public ProtectionContainer(String name, ProtectionContainerArgs args, CustomResourceOptions options)
    
    type: azure:siterecovery:ProtectionContainer
    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 ProtectionContainerArgs
    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 ProtectionContainerArgs
    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 ProtectionContainerArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProtectionContainerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProtectionContainerArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var protectionContainerResource = new Azure.SiteRecovery.ProtectionContainer("protectionContainerResource", new()
    {
        RecoveryFabricName = "string",
        RecoveryVaultName = "string",
        ResourceGroupName = "string",
        Name = "string",
    });
    
    example, err := siterecovery.NewProtectionContainer(ctx, "protectionContainerResource", &siterecovery.ProtectionContainerArgs{
    	RecoveryFabricName: pulumi.String("string"),
    	RecoveryVaultName:  pulumi.String("string"),
    	ResourceGroupName:  pulumi.String("string"),
    	Name:               pulumi.String("string"),
    })
    
    var protectionContainerResource = new ProtectionContainer("protectionContainerResource", ProtectionContainerArgs.builder()
        .recoveryFabricName("string")
        .recoveryVaultName("string")
        .resourceGroupName("string")
        .name("string")
        .build());
    
    protection_container_resource = azure.siterecovery.ProtectionContainer("protectionContainerResource",
        recovery_fabric_name="string",
        recovery_vault_name="string",
        resource_group_name="string",
        name="string")
    
    const protectionContainerResource = new azure.siterecovery.ProtectionContainer("protectionContainerResource", {
        recoveryFabricName: "string",
        recoveryVaultName: "string",
        resourceGroupName: "string",
        name: "string",
    });
    
    type: azure:siterecovery:ProtectionContainer
    properties:
        name: string
        recoveryFabricName: string
        recoveryVaultName: string
        resourceGroupName: string
    

    ProtectionContainer Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ProtectionContainer resource accepts the following input properties:

    RecoveryFabricName string
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    RecoveryVaultName string
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    ResourceGroupName string
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    Name string
    The name of the protection container. Changing this forces a new resource to be created.
    RecoveryFabricName string
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    RecoveryVaultName string
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    ResourceGroupName string
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    Name string
    The name of the protection container. Changing this forces a new resource to be created.
    recoveryFabricName String
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    recoveryVaultName String
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    resourceGroupName String
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    name String
    The name of the protection container. Changing this forces a new resource to be created.
    recoveryFabricName string
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    recoveryVaultName string
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    resourceGroupName string
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    name string
    The name of the protection container. Changing this forces a new resource to be created.
    recovery_fabric_name str
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    recovery_vault_name str
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    resource_group_name str
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    name str
    The name of the protection container. Changing this forces a new resource to be created.
    recoveryFabricName String
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    recoveryVaultName String
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    resourceGroupName String
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    name String
    The name of the protection container. Changing this forces a new resource to be created.

    Outputs

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

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

    Look up Existing ProtectionContainer Resource

    Get an existing ProtectionContainer 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?: ProtectionContainerState, opts?: CustomResourceOptions): ProtectionContainer
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            recovery_fabric_name: Optional[str] = None,
            recovery_vault_name: Optional[str] = None,
            resource_group_name: Optional[str] = None) -> ProtectionContainer
    func GetProtectionContainer(ctx *Context, name string, id IDInput, state *ProtectionContainerState, opts ...ResourceOption) (*ProtectionContainer, error)
    public static ProtectionContainer Get(string name, Input<string> id, ProtectionContainerState? state, CustomResourceOptions? opts = null)
    public static ProtectionContainer get(String name, Output<String> id, ProtectionContainerState 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:
    Name string
    The name of the protection container. Changing this forces a new resource to be created.
    RecoveryFabricName string
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    RecoveryVaultName string
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    ResourceGroupName string
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    Name string
    The name of the protection container. Changing this forces a new resource to be created.
    RecoveryFabricName string
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    RecoveryVaultName string
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    ResourceGroupName string
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    name String
    The name of the protection container. Changing this forces a new resource to be created.
    recoveryFabricName String
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    recoveryVaultName String
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    resourceGroupName String
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    name string
    The name of the protection container. Changing this forces a new resource to be created.
    recoveryFabricName string
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    recoveryVaultName string
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    resourceGroupName string
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    name str
    The name of the protection container. Changing this forces a new resource to be created.
    recovery_fabric_name str
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    recovery_vault_name str
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    resource_group_name str
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
    name String
    The name of the protection container. Changing this forces a new resource to be created.
    recoveryFabricName String
    Name of fabric that should contain this protection container. Changing this forces a new resource to be created.
    recoveryVaultName String
    The name of the vault that should be updated. Changing this forces a new resource to be created.
    resourceGroupName String
    Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.

    Import

    Site Recovery Protection Containers can be imported using the resource id, e.g.

    $ pulumi import azure:siterecovery/protectionContainer:ProtectionContainer mycontainer /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationFabrics/fabric-name/replicationProtectionContainers/protection-container-name
    

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

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi