azurermSiteRecoveryReplicationRecoveryPlan
Manages an Azure Site Recovery Plan within a Recovery Services vault. A recovery plan gathers machines into recovery groups for the purpose of failover.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupSource = new azurerm.resourceGroup.ResourceGroup(
this,
"source",
{
location: "west us",
name: "example-source-rg",
}
);
const azurermResourceGroupTarget = new azurerm.resourceGroup.ResourceGroup(
this,
"target",
{
location: "east us",
name: "example-target-rg",
}
);
const azurermRecoveryServicesVaultExample =
new azurerm.recoveryServicesVault.RecoveryServicesVault(this, "example", {
location: azurermResourceGroupTarget.location,
name: "example-kv",
resource_group_name: azurermResourceGroupTarget.name,
sku: "Standard",
});
const azurermSiteRecoveryFabricSource =
new azurerm.siteRecoveryFabric.SiteRecoveryFabric(this, "source_3", {
location: azurermResourceGroupSource.location,
name: "example-fabric-source",
recovery_vault_name: azurermRecoveryServicesVaultExample.name,
resource_group_name: "${azurerm_resource_group.example.name}",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSiteRecoveryFabricSource.overrideLogicalId("source");
const azurermSiteRecoveryFabricTarget =
new azurerm.siteRecoveryFabric.SiteRecoveryFabric(this, "target_4", {
depends_on: [`\${${azurermSiteRecoveryFabricSource.fqn}}`],
location: azurermResourceGroupTarget.location,
name: "example-fabric-target",
recovery_vault_name: azurermRecoveryServicesVaultExample.name,
resource_group_name: azurermResourceGroupTarget.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSiteRecoveryFabricTarget.overrideLogicalId("target");
const azurermSiteRecoveryReplicationRecoveryPlanExample =
new azurerm.siteRecoveryReplicationRecoveryPlan.SiteRecoveryReplicationRecoveryPlan(
this,
"example_5",
{
name: "example-recover-plan",
recovery_group: [
{
replicated_protected_items: [
"${azurerm_site_recovery_replicated_vm.test.id}",
],
type: "Boot",
},
{
type: "Failover",
},
{
type: "Shutdown",
},
],
recovery_vault_id: "${azurerm_recovery_services_vault.target.id}",
source_recovery_fabric_id: azurermSiteRecoveryFabricSource.id,
target_recovery_fabric_id: azurermSiteRecoveryFabricTarget.id,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSiteRecoveryReplicationRecoveryPlanExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) The name of the Replication Plan. The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number. Can be a maximum of 63 characters. Changing this forces a new resource to be created. -
recoveryVaultId
- (Required) The ID of the vault that should be updated. Changing this forces a new resource to be created. -
sourceRecoveryFabricId
- (Required) ID of source fabric to be recovered from. Changing this forces a new Replication Plan to be created. -
targetRecoveryFabricId
- (Required) ID of target fabric to recover. Changing this forces a new Replication Plan to be created. -
recoveryGroup
- (Optional) Three or morerecoveryGroup
block.
A recoveryGroup
block supports the following:
-
type
- (Required) The Recovery Plan Group Type. Possible values areboot
,failover
andshutdown
. -
replicatedProtectedItems
- (Optional) (required) one or more id of protected VM. -
preAction
- (Optional) one or moreaction
block as defined below. which will be executed before the group recovery. -
postAction
- (Optional) one or moreaction
block as defined below. which will be executed after the group recovery.
An action
block supports the following:
-
name
- (Required) Name of the Action. -
type
- (Required) Type of the action detail. Possible values areautomationRunbookActionDetails
,manualActionDetails
andscriptActionDetails
. -
failOverDirections
- (Required) Directions of fail over. Possible values areprimaryToRecovery
andrecoveryToPrimary
-
failOverTypes
- (Required) Types of fail over. Possible values aretestFailover
,plannedFailover
andunplannedFailover
-
fabricLocation
- (Optional) The fabric location of runbook or script. Possible values areprimary
andrecovery
.
-> NOTE: This is required when type
is set to automationRunbookActionDetails
or scriptActionDetails
.
runbookId
- (Optional) Id of runbook.
-> NOTE: This property is required when type
is set to automationRunbookActionDetails
.
manualActionInstruction
- (Optional) Instructions of manual action.
-> NOTE: This property is required when type
is set to manualActionDetails
.
scriptPath
- (Optional) Path of action script.
-> NOTE: This property is required when type
is set to scriptActionDetails
.
Attributes Reference
In addition to the arguments above, the following attributes are exported:
id
- The ID of the Site Recovery Fabric.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Site Recovery Replication Plan.update
- (Defaults to 30 minutes) Used when updating the Site Recovery Replication Plan.read
- (Defaults to 5 minutes) Used when retrieving the Site Recovery Replication Plan.delete
- (Defaults to 30 minutes) Used when deleting the Site Recovery Replication Plan.
Import
Site Recovery Fabric can be imported using the resourceId
, e.g.