azurermDataProtectionBackupInstanceDisk
Manages a Backup Instance to back up Disk.
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 azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermDataProtectionBackupVaultExample =
new azurerm.dataProtectionBackupVault.DataProtectionBackupVault(
this,
"example_1",
{
datastore_type: "VaultStore",
identity: [
{
type: "SystemAssigned",
},
],
location: azurermResourceGroupExample.location,
name: "example-backup-vault",
redundancy: "LocallyRedundant",
resource_group_name: azurermResourceGroupExample.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.*/
azurermDataProtectionBackupVaultExample.overrideLogicalId("example");
const azurermManagedDiskExample = new azurerm.managedDisk.ManagedDisk(
this,
"example_2",
{
create_option: "Empty",
disk_size_gb: "1",
location: azurermResourceGroupExample.location,
name: "example-disk",
resource_group_name: azurermResourceGroupExample.name,
storage_account_type: "Standard_LRS",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermManagedDiskExample.overrideLogicalId("example");
new azurerm.roleAssignment.RoleAssignment(this, "example1", {
principal_id: `\${${azurermDataProtectionBackupVaultExample.identity.fqn}[0].principal_id}`,
role_definition_name: "Disk Snapshot Contributor",
scope: azurermResourceGroupExample.id,
});
new azurerm.roleAssignment.RoleAssignment(this, "example2", {
principal_id: `\${${azurermDataProtectionBackupVaultExample.identity.fqn}[0].principal_id}`,
role_definition_name: "Disk Backup Reader",
scope: azurermManagedDiskExample.id,
});
const azurermDataProtectionBackupPolicyDiskExample =
new azurerm.dataProtectionBackupPolicyDisk.DataProtectionBackupPolicyDisk(
this,
"example_5",
{
backup_repeating_time_intervals: ["R/2021-05-19T06:33:16+00:00/PT4H"],
default_retention_duration: "P7D",
name: "example-backup-policy",
vault_id: azurermDataProtectionBackupVaultExample.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.*/
azurermDataProtectionBackupPolicyDiskExample.overrideLogicalId("example");
const azurermDataProtectionBackupInstanceDiskExample =
new azurerm.dataProtectionBackupInstanceDisk.DataProtectionBackupInstanceDisk(
this,
"example_6",
{
backup_policy_id: azurermDataProtectionBackupPolicyDiskExample.id,
disk_id: azurermManagedDiskExample.id,
location: azurermDataProtectionBackupVaultExample.location,
name: "example-backup-instance",
snapshot_resource_group_name: azurermResourceGroupExample.name,
vault_id: azurermDataProtectionBackupVaultExample.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.*/
azurermDataProtectionBackupInstanceDiskExample.overrideLogicalId("example");
Arguments Reference
The following arguments are supported:
-
name
- (Required) The name which should be used for this Backup Instance Disk. Changing this forces a new Backup Instance Disk to be created. -
location
- (Required) The Azure Region where the Backup Instance Disk should exist. Changing this forces a new Backup Instance Disk to be created. -
vaultId
- (Required) The ID of the Backup Vault within which the Backup Instance Disk should exist. Changing this forces a new Backup Instance Disk to be created. -
diskId
- (Required) The ID of the source Disk. Changing this forces a new Backup Instance Disk to be created. -
snapshotResourceGroupName
- (Required) The name of the Resource Group where snapshots are stored. Changing this forces a new Backup Instance Disk to be created. -
backupPolicyId
- (Required) The ID of the Backup Policy.
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the Backup Instance Disk.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Backup Instance Disk.read
- (Defaults to 5 minutes) Used when retrieving the Backup Instance Disk.update
- (Defaults to 30 minutes) Used when updating the Backup Instance Disk.delete
- (Defaults to 30 minutes) Used when deleting the Backup Instance Disk.
Import
Backup Instance Disks can be imported using the resourceId
, e.g.