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

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

azure.siterecovery.HyperVReplicationPolicyAssociation

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

    Manages an Azure Site Recovery replication policy for HyperV within a Recovery Vault.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-rg",
        location: "East US",
    });
    const exampleVault = new azure.recoveryservices.Vault("example", {
        name: "example-recovery-vault",
        location: example.location,
        resourceGroupName: example.name,
        sku: "Standard",
    });
    const exampleHyperVSite = new azure.siterecovery.HyperVSite("example", {
        recoveryVaultId: exampleVault.id,
        name: "example-site",
    });
    const exampleHyperVReplicationPolicy = new azure.siterecovery.HyperVReplicationPolicy("example", {
        name: "policy",
        recoveryVaultId: exampleVault.id,
        recoveryPointRetentionInHours: 2,
        applicationConsistentSnapshotFrequencyInHours: 1,
        replicationIntervalInSeconds: 300,
    });
    const exampleHyperVReplicationPolicyAssociation = new azure.siterecovery.HyperVReplicationPolicyAssociation("example", {
        name: "example-association",
        hypervSiteId: exampleHyperVSite.id,
        policyId: exampleHyperVReplicationPolicy.id,
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-rg",
        location="East US")
    example_vault = azure.recoveryservices.Vault("example",
        name="example-recovery-vault",
        location=example.location,
        resource_group_name=example.name,
        sku="Standard")
    example_hyper_v_site = azure.siterecovery.HyperVSite("example",
        recovery_vault_id=example_vault.id,
        name="example-site")
    example_hyper_v_replication_policy = azure.siterecovery.HyperVReplicationPolicy("example",
        name="policy",
        recovery_vault_id=example_vault.id,
        recovery_point_retention_in_hours=2,
        application_consistent_snapshot_frequency_in_hours=1,
        replication_interval_in_seconds=300)
    example_hyper_v_replication_policy_association = azure.siterecovery.HyperVReplicationPolicyAssociation("example",
        name="example-association",
        hyperv_site_id=example_hyper_v_site.id,
        policy_id=example_hyper_v_replication_policy.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/recoveryservices"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/siterecovery"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-rg"),
    			Location: pulumi.String("East US"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVault, err := recoveryservices.NewVault(ctx, "example", &recoveryservices.VaultArgs{
    			Name:              pulumi.String("example-recovery-vault"),
    			Location:          example.Location,
    			ResourceGroupName: example.Name,
    			Sku:               pulumi.String("Standard"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleHyperVSite, err := siterecovery.NewHyperVSite(ctx, "example", &siterecovery.HyperVSiteArgs{
    			RecoveryVaultId: exampleVault.ID(),
    			Name:            pulumi.String("example-site"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleHyperVReplicationPolicy, err := siterecovery.NewHyperVReplicationPolicy(ctx, "example", &siterecovery.HyperVReplicationPolicyArgs{
    			Name:                          pulumi.String("policy"),
    			RecoveryVaultId:               exampleVault.ID(),
    			RecoveryPointRetentionInHours: pulumi.Int(2),
    			ApplicationConsistentSnapshotFrequencyInHours: pulumi.Int(1),
    			ReplicationIntervalInSeconds:                  pulumi.Int(300),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = siterecovery.NewHyperVReplicationPolicyAssociation(ctx, "example", &siterecovery.HyperVReplicationPolicyAssociationArgs{
    			Name:         pulumi.String("example-association"),
    			HypervSiteId: exampleHyperVSite.ID(),
    			PolicyId:     exampleHyperVReplicationPolicy.ID(),
    		})
    		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 example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-rg",
            Location = "East US",
        });
    
        var exampleVault = new Azure.RecoveryServices.Vault("example", new()
        {
            Name = "example-recovery-vault",
            Location = example.Location,
            ResourceGroupName = example.Name,
            Sku = "Standard",
        });
    
        var exampleHyperVSite = new Azure.SiteRecovery.HyperVSite("example", new()
        {
            RecoveryVaultId = exampleVault.Id,
            Name = "example-site",
        });
    
        var exampleHyperVReplicationPolicy = new Azure.SiteRecovery.HyperVReplicationPolicy("example", new()
        {
            Name = "policy",
            RecoveryVaultId = exampleVault.Id,
            RecoveryPointRetentionInHours = 2,
            ApplicationConsistentSnapshotFrequencyInHours = 1,
            ReplicationIntervalInSeconds = 300,
        });
    
        var exampleHyperVReplicationPolicyAssociation = new Azure.SiteRecovery.HyperVReplicationPolicyAssociation("example", new()
        {
            Name = "example-association",
            HypervSiteId = exampleHyperVSite.Id,
            PolicyId = exampleHyperVReplicationPolicy.Id,
        });
    
    });
    
    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.HyperVSite;
    import com.pulumi.azure.siterecovery.HyperVSiteArgs;
    import com.pulumi.azure.siterecovery.HyperVReplicationPolicy;
    import com.pulumi.azure.siterecovery.HyperVReplicationPolicyArgs;
    import com.pulumi.azure.siterecovery.HyperVReplicationPolicyAssociation;
    import com.pulumi.azure.siterecovery.HyperVReplicationPolicyAssociationArgs;
    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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
                .name("example-rg")
                .location("East US")
                .build());
    
            var exampleVault = new Vault("exampleVault", VaultArgs.builder()
                .name("example-recovery-vault")
                .location(example.location())
                .resourceGroupName(example.name())
                .sku("Standard")
                .build());
    
            var exampleHyperVSite = new HyperVSite("exampleHyperVSite", HyperVSiteArgs.builder()
                .recoveryVaultId(exampleVault.id())
                .name("example-site")
                .build());
    
            var exampleHyperVReplicationPolicy = new HyperVReplicationPolicy("exampleHyperVReplicationPolicy", HyperVReplicationPolicyArgs.builder()
                .name("policy")
                .recoveryVaultId(exampleVault.id())
                .recoveryPointRetentionInHours(2)
                .applicationConsistentSnapshotFrequencyInHours(1)
                .replicationIntervalInSeconds(300)
                .build());
    
            var exampleHyperVReplicationPolicyAssociation = new HyperVReplicationPolicyAssociation("exampleHyperVReplicationPolicyAssociation", HyperVReplicationPolicyAssociationArgs.builder()
                .name("example-association")
                .hypervSiteId(exampleHyperVSite.id())
                .policyId(exampleHyperVReplicationPolicy.id())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-rg
          location: East US
      exampleVault:
        type: azure:recoveryservices:Vault
        name: example
        properties:
          name: example-recovery-vault
          location: ${example.location}
          resourceGroupName: ${example.name}
          sku: Standard
      exampleHyperVSite:
        type: azure:siterecovery:HyperVSite
        name: example
        properties:
          recoveryVaultId: ${exampleVault.id}
          name: example-site
      exampleHyperVReplicationPolicy:
        type: azure:siterecovery:HyperVReplicationPolicy
        name: example
        properties:
          name: policy
          recoveryVaultId: ${exampleVault.id}
          recoveryPointRetentionInHours: 2
          applicationConsistentSnapshotFrequencyInHours: 1
          replicationIntervalInSeconds: 300
      exampleHyperVReplicationPolicyAssociation:
        type: azure:siterecovery:HyperVReplicationPolicyAssociation
        name: example
        properties:
          name: example-association
          hypervSiteId: ${exampleHyperVSite.id}
          policyId: ${exampleHyperVReplicationPolicy.id}
    

    Create HyperVReplicationPolicyAssociation Resource

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

    Constructor syntax

    new HyperVReplicationPolicyAssociation(name: string, args: HyperVReplicationPolicyAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def HyperVReplicationPolicyAssociation(resource_name: str,
                                           args: HyperVReplicationPolicyAssociationArgs,
                                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def HyperVReplicationPolicyAssociation(resource_name: str,
                                           opts: Optional[ResourceOptions] = None,
                                           hyperv_site_id: Optional[str] = None,
                                           policy_id: Optional[str] = None,
                                           name: Optional[str] = None)
    func NewHyperVReplicationPolicyAssociation(ctx *Context, name string, args HyperVReplicationPolicyAssociationArgs, opts ...ResourceOption) (*HyperVReplicationPolicyAssociation, error)
    public HyperVReplicationPolicyAssociation(string name, HyperVReplicationPolicyAssociationArgs args, CustomResourceOptions? opts = null)
    public HyperVReplicationPolicyAssociation(String name, HyperVReplicationPolicyAssociationArgs args)
    public HyperVReplicationPolicyAssociation(String name, HyperVReplicationPolicyAssociationArgs args, CustomResourceOptions options)
    
    type: azure:siterecovery:HyperVReplicationPolicyAssociation
    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 HyperVReplicationPolicyAssociationArgs
    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 HyperVReplicationPolicyAssociationArgs
    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 HyperVReplicationPolicyAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args HyperVReplicationPolicyAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args HyperVReplicationPolicyAssociationArgs
    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 hyperVReplicationPolicyAssociationResource = new Azure.SiteRecovery.HyperVReplicationPolicyAssociation("hyperVReplicationPolicyAssociationResource", new()
    {
        HypervSiteId = "string",
        PolicyId = "string",
        Name = "string",
    });
    
    example, err := siterecovery.NewHyperVReplicationPolicyAssociation(ctx, "hyperVReplicationPolicyAssociationResource", &siterecovery.HyperVReplicationPolicyAssociationArgs{
    	HypervSiteId: pulumi.String("string"),
    	PolicyId:     pulumi.String("string"),
    	Name:         pulumi.String("string"),
    })
    
    var hyperVReplicationPolicyAssociationResource = new HyperVReplicationPolicyAssociation("hyperVReplicationPolicyAssociationResource", HyperVReplicationPolicyAssociationArgs.builder()
        .hypervSiteId("string")
        .policyId("string")
        .name("string")
        .build());
    
    hyper_v_replication_policy_association_resource = azure.siterecovery.HyperVReplicationPolicyAssociation("hyperVReplicationPolicyAssociationResource",
        hyperv_site_id="string",
        policy_id="string",
        name="string")
    
    const hyperVReplicationPolicyAssociationResource = new azure.siterecovery.HyperVReplicationPolicyAssociation("hyperVReplicationPolicyAssociationResource", {
        hypervSiteId: "string",
        policyId: "string",
        name: "string",
    });
    
    type: azure:siterecovery:HyperVReplicationPolicyAssociation
    properties:
        hypervSiteId: string
        name: string
        policyId: string
    

    HyperVReplicationPolicyAssociation 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 HyperVReplicationPolicyAssociation resource accepts the following input properties:

    HypervSiteId string
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    PolicyId string
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    Name string
    The name of the replication policy association. Changing this forces a new association to be created.
    HypervSiteId string
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    PolicyId string
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    Name string
    The name of the replication policy association. Changing this forces a new association to be created.
    hypervSiteId String
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    policyId String
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    name String
    The name of the replication policy association. Changing this forces a new association to be created.
    hypervSiteId string
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    policyId string
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    name string
    The name of the replication policy association. Changing this forces a new association to be created.
    hyperv_site_id str
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    policy_id str
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    name str
    The name of the replication policy association. Changing this forces a new association to be created.
    hypervSiteId String
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    policyId String
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    name String
    The name of the replication policy association. Changing this forces a new association to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the HyperVReplicationPolicyAssociation 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 HyperVReplicationPolicyAssociation Resource

    Get an existing HyperVReplicationPolicyAssociation 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?: HyperVReplicationPolicyAssociationState, opts?: CustomResourceOptions): HyperVReplicationPolicyAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            hyperv_site_id: Optional[str] = None,
            name: Optional[str] = None,
            policy_id: Optional[str] = None) -> HyperVReplicationPolicyAssociation
    func GetHyperVReplicationPolicyAssociation(ctx *Context, name string, id IDInput, state *HyperVReplicationPolicyAssociationState, opts ...ResourceOption) (*HyperVReplicationPolicyAssociation, error)
    public static HyperVReplicationPolicyAssociation Get(string name, Input<string> id, HyperVReplicationPolicyAssociationState? state, CustomResourceOptions? opts = null)
    public static HyperVReplicationPolicyAssociation get(String name, Output<String> id, HyperVReplicationPolicyAssociationState 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:
    HypervSiteId string
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    Name string
    The name of the replication policy association. Changing this forces a new association to be created.
    PolicyId string
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    HypervSiteId string
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    Name string
    The name of the replication policy association. Changing this forces a new association to be created.
    PolicyId string
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    hypervSiteId String
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    name String
    The name of the replication policy association. Changing this forces a new association to be created.
    policyId String
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    hypervSiteId string
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    name string
    The name of the replication policy association. Changing this forces a new association to be created.
    policyId string
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    hyperv_site_id str
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    name str
    The name of the replication policy association. Changing this forces a new association to be created.
    policy_id str
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.
    hypervSiteId String
    The ID of the HyperV site to which the policy should be associated. Changing this forces a new association to be created.
    name String
    The name of the replication policy association. Changing this forces a new association to be created.
    policyId String
    The ID of the HyperV replication policy which to be associated. Changing this forces a new association to be created.

    Import

    Site Recovery Replication Policies can be imported using the resource id, e.g.

    $ pulumi import azure:siterecovery/hyperVReplicationPolicyAssociation:HyperVReplicationPolicyAssociation azurerm_site_recovery_hyperv_replication_policy_association.mypolicy /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationFabrics/site-name/replicationProtectionContainers/container-name/replicationProtectionContainerMappings/mapping-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 Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi