We recommend using Azure Native.
azure.siterecovery.HyperVReplicationPolicy
Explore with Pulumi AI
Manages a Azure Site Recovery replication policy for HyperV within a Recovery Vault. Replication policies define the frequency at which recovery points are created and how long they are stored.
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 vault = new azure.recoveryservices.Vault("vault", {
name: "example-recovery-vault",
location: example.location,
resourceGroupName: example.name,
sku: "Standard",
});
const policy = new azure.siterecovery.HyperVReplicationPolicy("policy", {
name: "policy",
recoveryVaultId: vault.id,
recoveryPointRetentionInHours: 2,
applicationConsistentSnapshotFrequencyInHours: 1,
replicationIntervalInSeconds: 300,
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-rg",
location="East US")
vault = azure.recoveryservices.Vault("vault",
name="example-recovery-vault",
location=example.location,
resource_group_name=example.name,
sku="Standard")
policy = azure.siterecovery.HyperVReplicationPolicy("policy",
name="policy",
recovery_vault_id=vault.id,
recovery_point_retention_in_hours=2,
application_consistent_snapshot_frequency_in_hours=1,
replication_interval_in_seconds=300)
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
}
vault, err := recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
Name: pulumi.String("example-recovery-vault"),
Location: example.Location,
ResourceGroupName: example.Name,
Sku: pulumi.String("Standard"),
})
if err != nil {
return err
}
_, err = siterecovery.NewHyperVReplicationPolicy(ctx, "policy", &siterecovery.HyperVReplicationPolicyArgs{
Name: pulumi.String("policy"),
RecoveryVaultId: vault.ID(),
RecoveryPointRetentionInHours: pulumi.Int(2),
ApplicationConsistentSnapshotFrequencyInHours: pulumi.Int(1),
ReplicationIntervalInSeconds: pulumi.Int(300),
})
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 vault = new Azure.RecoveryServices.Vault("vault", new()
{
Name = "example-recovery-vault",
Location = example.Location,
ResourceGroupName = example.Name,
Sku = "Standard",
});
var policy = new Azure.SiteRecovery.HyperVReplicationPolicy("policy", new()
{
Name = "policy",
RecoveryVaultId = vault.Id,
RecoveryPointRetentionInHours = 2,
ApplicationConsistentSnapshotFrequencyInHours = 1,
ReplicationIntervalInSeconds = 300,
});
});
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.HyperVReplicationPolicy;
import com.pulumi.azure.siterecovery.HyperVReplicationPolicyArgs;
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 vault = new Vault("vault", VaultArgs.builder()
.name("example-recovery-vault")
.location(example.location())
.resourceGroupName(example.name())
.sku("Standard")
.build());
var policy = new HyperVReplicationPolicy("policy", HyperVReplicationPolicyArgs.builder()
.name("policy")
.recoveryVaultId(vault.id())
.recoveryPointRetentionInHours(2)
.applicationConsistentSnapshotFrequencyInHours(1)
.replicationIntervalInSeconds(300)
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-rg
location: East US
vault:
type: azure:recoveryservices:Vault
properties:
name: example-recovery-vault
location: ${example.location}
resourceGroupName: ${example.name}
sku: Standard
policy:
type: azure:siterecovery:HyperVReplicationPolicy
properties:
name: policy
recoveryVaultId: ${vault.id}
recoveryPointRetentionInHours: 2
applicationConsistentSnapshotFrequencyInHours: 1
replicationIntervalInSeconds: 300
Create HyperVReplicationPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new HyperVReplicationPolicy(name: string, args: HyperVReplicationPolicyArgs, opts?: CustomResourceOptions);
@overload
def HyperVReplicationPolicy(resource_name: str,
args: HyperVReplicationPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def HyperVReplicationPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
application_consistent_snapshot_frequency_in_hours: Optional[int] = None,
recovery_point_retention_in_hours: Optional[int] = None,
recovery_vault_id: Optional[str] = None,
replication_interval_in_seconds: Optional[int] = None,
name: Optional[str] = None)
func NewHyperVReplicationPolicy(ctx *Context, name string, args HyperVReplicationPolicyArgs, opts ...ResourceOption) (*HyperVReplicationPolicy, error)
public HyperVReplicationPolicy(string name, HyperVReplicationPolicyArgs args, CustomResourceOptions? opts = null)
public HyperVReplicationPolicy(String name, HyperVReplicationPolicyArgs args)
public HyperVReplicationPolicy(String name, HyperVReplicationPolicyArgs args, CustomResourceOptions options)
type: azure:siterecovery:HyperVReplicationPolicy
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 HyperVReplicationPolicyArgs
- 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 HyperVReplicationPolicyArgs
- 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 HyperVReplicationPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HyperVReplicationPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args HyperVReplicationPolicyArgs
- 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 hyperVReplicationPolicyResource = new Azure.SiteRecovery.HyperVReplicationPolicy("hyperVReplicationPolicyResource", new()
{
ApplicationConsistentSnapshotFrequencyInHours = 0,
RecoveryPointRetentionInHours = 0,
RecoveryVaultId = "string",
ReplicationIntervalInSeconds = 0,
Name = "string",
});
example, err := siterecovery.NewHyperVReplicationPolicy(ctx, "hyperVReplicationPolicyResource", &siterecovery.HyperVReplicationPolicyArgs{
ApplicationConsistentSnapshotFrequencyInHours: pulumi.Int(0),
RecoveryPointRetentionInHours: pulumi.Int(0),
RecoveryVaultId: pulumi.String("string"),
ReplicationIntervalInSeconds: pulumi.Int(0),
Name: pulumi.String("string"),
})
var hyperVReplicationPolicyResource = new HyperVReplicationPolicy("hyperVReplicationPolicyResource", HyperVReplicationPolicyArgs.builder()
.applicationConsistentSnapshotFrequencyInHours(0)
.recoveryPointRetentionInHours(0)
.recoveryVaultId("string")
.replicationIntervalInSeconds(0)
.name("string")
.build());
hyper_v_replication_policy_resource = azure.siterecovery.HyperVReplicationPolicy("hyperVReplicationPolicyResource",
application_consistent_snapshot_frequency_in_hours=0,
recovery_point_retention_in_hours=0,
recovery_vault_id="string",
replication_interval_in_seconds=0,
name="string")
const hyperVReplicationPolicyResource = new azure.siterecovery.HyperVReplicationPolicy("hyperVReplicationPolicyResource", {
applicationConsistentSnapshotFrequencyInHours: 0,
recoveryPointRetentionInHours: 0,
recoveryVaultId: "string",
replicationIntervalInSeconds: 0,
name: "string",
});
type: azure:siterecovery:HyperVReplicationPolicy
properties:
applicationConsistentSnapshotFrequencyInHours: 0
name: string
recoveryPointRetentionInHours: 0
recoveryVaultId: string
replicationIntervalInSeconds: 0
HyperVReplicationPolicy 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 HyperVReplicationPolicy resource accepts the following input properties:
- Application
Consistent intSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- Recovery
Point intRetention In Hours - The duration in hours for which the recovery points need to be stored.
- Recovery
Vault stringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- Replication
Interval intIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
. - Name string
- The name of the replication policy. Changing this forces a new resource to be created.
- Application
Consistent intSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- Recovery
Point intRetention In Hours - The duration in hours for which the recovery points need to be stored.
- Recovery
Vault stringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- Replication
Interval intIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
. - Name string
- The name of the replication policy. Changing this forces a new resource to be created.
- application
Consistent IntegerSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- recovery
Point IntegerRetention In Hours - The duration in hours for which the recovery points need to be stored.
- recovery
Vault StringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- replication
Interval IntegerIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
. - name String
- The name of the replication policy. Changing this forces a new resource to be created.
- application
Consistent numberSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- recovery
Point numberRetention In Hours - The duration in hours for which the recovery points need to be stored.
- recovery
Vault stringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- replication
Interval numberIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
. - name string
- The name of the replication policy. Changing this forces a new resource to be created.
- application_
consistent_ intsnapshot_ frequency_ in_ hours - Specifies the frequency at which to create application consistent recovery points.
- recovery_
point_ intretention_ in_ hours - The duration in hours for which the recovery points need to be stored.
- recovery_
vault_ strid - The id of the vault that should be updated. Changing this forces a new resource to be created.
- replication_
interval_ intin_ seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
. - name str
- The name of the replication policy. Changing this forces a new resource to be created.
- application
Consistent NumberSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- recovery
Point NumberRetention In Hours - The duration in hours for which the recovery points need to be stored.
- recovery
Vault StringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- replication
Interval NumberIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
. - name String
- The name of the replication policy. Changing this forces a new resource to be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the HyperVReplicationPolicy 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 HyperVReplicationPolicy Resource
Get an existing HyperVReplicationPolicy 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?: HyperVReplicationPolicyState, opts?: CustomResourceOptions): HyperVReplicationPolicy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
application_consistent_snapshot_frequency_in_hours: Optional[int] = None,
name: Optional[str] = None,
recovery_point_retention_in_hours: Optional[int] = None,
recovery_vault_id: Optional[str] = None,
replication_interval_in_seconds: Optional[int] = None) -> HyperVReplicationPolicy
func GetHyperVReplicationPolicy(ctx *Context, name string, id IDInput, state *HyperVReplicationPolicyState, opts ...ResourceOption) (*HyperVReplicationPolicy, error)
public static HyperVReplicationPolicy Get(string name, Input<string> id, HyperVReplicationPolicyState? state, CustomResourceOptions? opts = null)
public static HyperVReplicationPolicy get(String name, Output<String> id, HyperVReplicationPolicyState 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.
- Application
Consistent intSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- Name string
- The name of the replication policy. Changing this forces a new resource to be created.
- Recovery
Point intRetention In Hours - The duration in hours for which the recovery points need to be stored.
- Recovery
Vault stringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- Replication
Interval intIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
.
- Application
Consistent intSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- Name string
- The name of the replication policy. Changing this forces a new resource to be created.
- Recovery
Point intRetention In Hours - The duration in hours for which the recovery points need to be stored.
- Recovery
Vault stringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- Replication
Interval intIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
.
- application
Consistent IntegerSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- name String
- The name of the replication policy. Changing this forces a new resource to be created.
- recovery
Point IntegerRetention In Hours - The duration in hours for which the recovery points need to be stored.
- recovery
Vault StringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- replication
Interval IntegerIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
.
- application
Consistent numberSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- name string
- The name of the replication policy. Changing this forces a new resource to be created.
- recovery
Point numberRetention In Hours - The duration in hours for which the recovery points need to be stored.
- recovery
Vault stringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- replication
Interval numberIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
.
- application_
consistent_ intsnapshot_ frequency_ in_ hours - Specifies the frequency at which to create application consistent recovery points.
- name str
- The name of the replication policy. Changing this forces a new resource to be created.
- recovery_
point_ intretention_ in_ hours - The duration in hours for which the recovery points need to be stored.
- recovery_
vault_ strid - The id of the vault that should be updated. Changing this forces a new resource to be created.
- replication_
interval_ intin_ seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
.
- application
Consistent NumberSnapshot Frequency In Hours - Specifies the frequency at which to create application consistent recovery points.
- name String
- The name of the replication policy. Changing this forces a new resource to be created.
- recovery
Point NumberRetention In Hours - The duration in hours for which the recovery points need to be stored.
- recovery
Vault StringId - The id of the vault that should be updated. Changing this forces a new resource to be created.
- replication
Interval NumberIn Seconds - Specifies how frequently data should be synchronized between source and target locations. Possible values are
30
and300
.
Import
Site Recovery Replication Policies can be imported using the resource id
, e.g.
$ pulumi import azure:siterecovery/hyperVReplicationPolicy:HyperVReplicationPolicy mypolicy /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationPolicies/policy-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.