Provides a HBR Policy resource.
For information about HBR Policy and how to use it, see What is Policy.
Basic Usage
variable "name" {
default = "terraform-example"
}
provider "alicloud" {
region = "cn-hangzhou"
}
resource "random_integer" "default" {
max = 99999
min = 10000
}
resource "alicloud_hbr_vault" "defaultyk84Hc" {
vault_type = "STANDARD"
vault_name = "example-value-${random_integer.default.result}"
}
resource "alicloud_hbr_policy" "defaultoqWvHQ" {
policy_name = "example-value-${random_integer.default.result}"
rules {
rule_type = "BACKUP"
backup_type = "COMPLETE"
schedule = "I|1631685600|P1D"
retention = "7"
archive_days = "0"
vault_id = alicloud_hbr_vault.defaultyk84Hc.id
}
policy_description = "policy example"
}
The following arguments are supported:
policy_description
- (Optional) The policy description.policy_name
- (Optional) Policy Name.rules
- (Optional) A list of policy rules. See rules
below.rules
The rules supports the following:
archive_days
- (Optional, Computed) This parameter is required only when the value of RuleType is **TRANSITION. The minimum value is 30, and the Retention-ArchiveDays needs to be greater than or equal to 60.backup_type
- (Optional) This parameter is required only when the RuleType value is **BACKUP. Backup Type.keep_latest_snapshots
- (Optional) This parameter is required only when RuleType is set to BACKUP.replication_region_id
- (Optional) Only when the RuleType value is.retention
- (Optional) This parameter is required only when the value of RuleType is TRANSITION or **REPLICATION.
retention_rules
- (Optional) This parameter is required only when the value of RuleType is TRANSITION. See retention_rules
below.rule_type
- (Required) Rule Type.schedule
- (Optional) This parameter is required only if you set the RuleType parameter to BACKUP. This parameter specifies the backup schedule settings. Format: I|{startTime}|{interval}
. The system runs the first backup job at a point in time that is specified in the {startTime} parameter and the subsequent backup jobs at an interval that is specified in the {interval} parameter. The system does not run a backup job before the specified point in time. Each backup job, except the first one, starts only after the previous backup job is complete. For example, I|1631685600|P1D
specifies that the system runs the first backup job at 14:00:00 on September 15, 2021 and the subsequent backup jobs once a day. * startTime: the time at which the system starts to run a backup job. The time must follow the UNIX time format. Unit: seconds. * interval: the interval at which the system runs a backup job. The interval must follow the ISO 8601 standard. For example, PT1H specifies an interval of one hour. P1D specifies an interval of one day.vault_id
- (Optional) Vault ID.rules-retention_rules
The rules-retention_rules supports the following:
advanced_retention_type
- (Optional) Valid values: annually, MONTHLY, and WEEKLY:- annually: the first backup of each year. - MONTHLY: The first backup of the month. - WEEKLY: The first backup of the week.retention
- (Optional) Retention time, in days.The following attributes are exported:
id
- The ID of the resource supplied above.create_time
- Policy creation time.rules
- A list of policy rules.
rule_id
- Rule ID.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 5 mins) Used when create the Policy.delete
- (Defaults to 5 mins) Used when delete the Policy.update
- (Defaults to 5 mins) Used when update the Policy.HBR Policy can be imported using the id, e.g.
$ terraform import alicloud_hbr_policy.example <id>