azurermDataProtectionBackupPolicyPostgresql
Manages a Backup Policy to back up PostgreSQL.
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",
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 azurermDataProtectionBackupPolicyPostgresqlExample =
new azurerm.dataProtectionBackupPolicyPostgresql.DataProtectionBackupPolicyPostgresql(
this,
"example_2",
{
backup_repeating_time_intervals: ["R/2021-05-23T02:30:00+00:00/P1W"],
default_retention_duration: "P4M",
name: "example-backup-policy",
resource_group_name: azurermResourceGroupExample.name,
retention_rule: [
{
criteria: [
{
absolute_criteria: "FirstOfWeek",
},
],
duration: "P6M",
name: "weekly",
priority: 20,
},
{
criteria: [
{
days_of_week: ["Thursday"],
scheduled_backup_times: ["2021-05-23T02:30:00Z"],
},
],
duration: "P1W",
name: "thursday",
priority: 25,
},
{
criteria: [
{
days_of_week: ["Tuesday"],
scheduled_backup_times: ["2021-05-23T02:30:00Z"],
weeks_of_month: ["First", "Last"],
},
],
duration: "P1D",
name: "monthly",
priority: 15,
},
],
vault_name: azurermDataProtectionBackupVaultExample.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.*/
azurermDataProtectionBackupPolicyPostgresqlExample.overrideLogicalId("example");
Arguments Reference
The following arguments are supported:
-
name
- (Required) The name which should be used for this Backup Policy PostgreSQL. Changing this forces a new Backup Policy PostgreSQL to be created. -
resourceGroupName
- (Required) The name of the Resource Group where the Backup Policy PostgreSQL should exist. Changing this forces a new Backup Policy PostgreSQL to be created. -
vaultName
- (Required) The name of the Backup Vault where the Backup Policy PostgreSQL should exist. Changing this forces a new Backup Policy PostgreSQL to be created. -
backupRepeatingTimeIntervals
- (Required) Specifies a list of repeating time interval. It supports weekly back. It should followiso8601
repeating time interval. Changing this forces a new Backup Policy PostgreSQL to be created. -
defaultRetentionDuration
- (Required) The duration of default retention rule. It should followiso8601
duration format. Changing this forces a new Backup Policy PostgreSQL to be created.
retentionRule
- (Optional) One or moreretentionRule
blocks as defined below. Changing this forces a new Backup Policy PostgreSQL to be created.
A retentionRule
block supports the following:
-
name
- (Required) The name which should be used for this retention rule. Changing this forces a new Backup Policy PostgreSQL to be created. -
duration
- (Required) Duration after which the backup is deleted. It should followiso8601
duration format. Changing this forces a new Backup Policy PostgreSQL to be created. -
criteria
- (Required) Acriteria
block as defined below. Changing this forces a new Backup Policy PostgreSQL to be created. -
priority
- (Required) Specifies the priority of the rule. The priority number must be unique for each rule. The lower the priority number, the higher the priority of the rule. Changing this forces a new Backup Policy PostgreSQL to be created.
A criteria
block supports the following:
-
absoluteCriteria
- (Optional) Possible values areallBackup
,firstOfDay
,firstOfWeek
,firstOfMonth
andfirstOfYear
. These values mean the first successful backup of the day/week/month/year. Changing this forces a new Backup Policy PostgreSQL to be created. -
daysOfWeek
- (Optional) Possible values aremonday
,tuesday
,thursday
,friday
,saturday
andsunday
. Changing this forces a new Backup Policy PostgreSQL to be created. -
monthsOfYear
- (Optional) Possible values arejanuary
,february
,march
,april
,may
,june
,july
,august
,september
,october
,november
anddecember
. Changing this forces a new Backup Policy PostgreSQL to be created. -
scheduledBackupTimes
- (Optional) Specifies a list of backup times for backup in therfc3339
format. Changing this forces a new Backup Policy PostgreSQL to be created. -
weeksOfMonth
- (Optional) Possible values arefirst
,second
,third
,fourth
andlast
. Changing this forces a new Backup Policy PostgreSQL to be created.
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the Backup Policy PostgreSQL.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Backup Policy PostgreSQL.read
- (Defaults to 5 minutes) Used when retrieving the Backup Policy PostgreSQL.update
- (Defaults to 30 minutes) Used when updating the Backup Policy PostgreSQL.delete
- (Defaults to 30 minutes) Used when deleting the Backup Policy PostgreSQL.
Import
Backup Policy PostgreSQL's can be imported using the resourceId
, e.g.