azurermBackupPolicyFileShare
Manages an Azure File Share Backup Policy within a Recovery Services vault.
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: "tfex-recovery_vault",
}
);
const azurermRecoveryServicesVaultExample =
new azurerm.recoveryServicesVault.RecoveryServicesVault(this, "example_1", {
location: azurermResourceGroupExample.location,
name: "tfex-recovery-vault",
resource_group_name: azurermResourceGroupExample.name,
sku: "Standard",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermRecoveryServicesVaultExample.overrideLogicalId("example");
new azurerm.backupPolicyFileShare.BackupPolicyFileShare(this, "policy", {
backup: [
{
frequency: "Daily",
time: "23:00",
},
],
name: "tfex-recovery-vault-policy",
recovery_vault_name: azurermRecoveryServicesVaultExample.name,
resource_group_name: azurermResourceGroupExample.name,
retention_daily: [
{
count: 10,
},
],
retention_monthly: [
{
count: 7,
weekdays: ["Sunday", "Wednesday"],
weeks: ["First", "Last"],
},
],
retention_weekly: [
{
count: 7,
weekdays: ["Sunday", "Wednesday", "Friday", "Saturday"],
},
],
retention_yearly: [
{
count: 7,
months: ["January"],
weekdays: ["Sunday"],
weeks: ["Last"],
},
],
timezone: "UTC",
});
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the policy. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The name of the resource group in which to create the policy. Changing this forces a new resource to be created. -
recoveryVaultName
- (Required) Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created. -
backup
- (Required) Configures the Policy backup frequency and times as documented in thebackup
block below. -
timezone
- (Optional) Specifies the timezone. the possible values are defined here. Defaults toutc
-> NOTE: The maximum number of snapshots that Azure Files can retain is 200. If your combined snapshot count exceeds 200 based on your retention policies, it will result in an error. See this article for more information.
-
retentionDaily
- (Required) Configures the policy daily retention as documented in theretentionDaily
block below. -
retentionWeekly
- (Optional) Configures the policy weekly retention as documented in theretentionWeekly
block below. -
retentionMonthly
- (Optional) Configures the policy monthly retention as documented in theretentionMonthly
block below. -
retentionYearly
- (Optional) Configures the policy yearly retention as documented in theretentionYearly
block below.
The backup
block supports:
frequency
- (Required) Sets the backup frequency. Currently, onlydaily
is supported
-> NOTE: This argument is made available for consistency with VM backup policies and to allow for potential future support of weekly backups
time
- (Required) The time of day to perform the backup in 24-hour format. Times must be either on the hour or half hour (e.g. 12:00, 12:30, 13:00, etc.)
The retentionDaily
block supports:
count
- (Required) The number of daily backups to keep. Must be between1
and200
(inclusive)
The retentionWeekly
block supports:
-
count
- (Required) The number of daily backups to keep. Must be between1
and200
(inclusive) -
weekdays
- (Required) The weekday backups to retain. Must be one ofsunday
,monday
,tuesday
,wednesday
,thursday
,friday
orsaturday
.
The retentionMonthly
block supports:
-
count
- (Required) The number of monthly backups to keep. Must be between1
and120
-
weekdays
- (Required) The weekday backups to retain . Must be one ofsunday
,monday
,tuesday
,wednesday
,thursday
,friday
orsaturday
. -
weeks
- (Required) The weeks of the month to retain backups of. Must be one offirst
,second
,third
,fourth
,last
.
The retentionYearly
block supports:
-
count
- (Required) The number of yearly backups to keep. Must be between1
and10
-
weekdays
- (Required) The weekday backups to retain . Must be one ofsunday
,monday
,tuesday
,wednesday
,thursday
,friday
orsaturday
. -
weeks
- (Required) The weeks of the month to retain backups of. Must be one offirst
,second
,third
,fourth
,last
. -
months
- (Required) The months of the year to retain backups of. Must be one ofjanuary
,february
,march
,april
,may
,june
,july
,augest
,september
,october
,november
anddecember
.
Attributes Reference
The following attributes are exported:
id
- The ID of the Azure File Share Backup Policy.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the File Share Backup Policy.update
- (Defaults to 30 minutes) Used when updating the File Share Backup Policy.read
- (Defaults to 5 minutes) Used when retrieving the File Share Backup Policy.delete
- (Defaults to 30 minutes) Used when deleting the File Share Backup Policy.
Import
Azure File Share Backup Policies can be imported using the resourceId
, e.g.