From e0c82817c8ae6dd21396d37054f24234b61b0d67 Mon Sep 17 00:00:00 2001 From: Zhukun-Huawei <145660317+Zhukun-Huawei@users.noreply.github.com> Date: Wed, 3 Jan 2024 17:34:28 +0800 Subject: [PATCH] docs(cbr): add some fields for CBR (#1085) --- docs/resources/cbr_policy.md | 10 +++++++- ...resource_flexibleengine_cbr_policy_test.go | 23 +++++++++++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/docs/resources/cbr_policy.md b/docs/resources/cbr_policy.md index 8dafd1694..6a33ec2d3 100644 --- a/docs/resources/cbr_policy.md +++ b/docs/resources/cbr_policy.md @@ -66,13 +66,17 @@ The following arguments are supported: Changing this will create a new policy. * `backup_cycle` - (Required, List) Specifies the scheduling rule for the policy backup execution. - The [object](#cbr_policy_backup_cycle) structure is documented below. + The [backup_cycle](#cbr_policy_backup_cycle) structure is documented below. * `enabled` - (Optional, Bool) Specifies whether to enable the policy. Default to **true**. * `destination_region` - (Optional, String) Specifies the name of the replication destination region, which is mandatory for cross-region replication. Required if `protection_type` is **replication**. +* `enable_acceleration` - (Optional, Bool, ForceNew) Specifies whether to enable the acceleration function to shorten + the replication time for cross-region. + Changing this will create a new policy. + * `destination_project_id` - (Optional, String) Specifies the ID of the replication destination project, which is mandatory for cross-region replication. Required if `protection_type` is **replication**. @@ -122,6 +126,10 @@ The `long_term_retention` block supports: -> A maximum of 10 backups are retained for failed periodic backup tasks. They are retained for one month and can be manually deleted on the web console. +* `full_backup_interval` - (Optional, Int) Specifies how often (after how many incremental backups) a full backup is + performed. The valid value ranges from `-1` to `100`. + If `-1` is specified, full backup will not be performed. + ## Attribute Reference In addition to all arguments above, the following attributes are exported: diff --git a/flexibleengine/acceptance/resource_flexibleengine_cbr_policy_test.go b/flexibleengine/acceptance/resource_flexibleengine_cbr_policy_test.go index 9b9c46c57..5888f4419 100644 --- a/flexibleengine/acceptance/resource_flexibleengine_cbr_policy_test.go +++ b/flexibleengine/acceptance/resource_flexibleengine_cbr_policy_test.go @@ -78,6 +78,7 @@ func TestAccCBRV3Policy_retention(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "long_term_retention.0.daily", "10"), resource.TestCheckResourceAttr(resourceName, "long_term_retention.0.weekly", "10"), resource.TestCheckResourceAttr(resourceName, "long_term_retention.0.monthly", "1"), + resource.TestCheckResourceAttr(resourceName, "long_term_retention.0.full_backup_interval", "-1"), resource.TestCheckResourceAttr(resourceName, "backup_cycle.0.days", "SA,SU"), resource.TestCheckResourceAttr(resourceName, "backup_cycle.0.execution_times.0", "08:00"), resource.TestCheckResourceAttr(resourceName, "backup_cycle.0.execution_times.1", "20:00"), @@ -95,6 +96,7 @@ func TestAccCBRV3Policy_retention(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "long_term_retention.0.weekly", "20"), resource.TestCheckResourceAttr(resourceName, "long_term_retention.0.monthly", "6"), resource.TestCheckResourceAttr(resourceName, "long_term_retention.0.yearly", "1"), + resource.TestCheckResourceAttr(resourceName, "long_term_retention.0.full_backup_interval", "5"), resource.TestCheckResourceAttr(resourceName, "backup_cycle.0.days", "SA,SU"), resource.TestCheckResourceAttr(resourceName, "backup_cycle.0.execution_times.0", "08:00"), resource.TestCheckResourceAttr(resourceName, "backup_cycle.0.execution_times.1", "20:00"), @@ -132,6 +134,7 @@ func TestAccCBRV3Policy_replication(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "destination_region", OS_DEST_REGION), resource.TestCheckResourceAttr(resourceName, "destination_project_id", OS_DEST_PROJECT_ID), resource.TestCheckResourceAttr(resourceName, "time_period", "20"), + resource.TestCheckResourceAttr(resourceName, "enable_acceleration", "true"), resource.TestCheckResourceAttr(resourceName, "backup_cycle.0.interval", "5"), resource.TestCheckResourceAttr(resourceName, "backup_cycle.0.execution_times.0", "06:00"), resource.TestCheckResourceAttr(resourceName, "backup_cycle.0.execution_times.1", "18:00"), @@ -141,6 +144,9 @@ func TestAccCBRV3Policy_replication(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "enable_acceleration", + }, }, }, }) @@ -238,9 +244,10 @@ resource "flexibleengine_cbr_policy" "test" { time_zone = "UTC+08:00" long_term_retention { - daily = 10 - weekly = 10 - monthly = 1 + daily = 10 + weekly = 10 + monthly = 1 + full_backup_interval = -1 } backup_cycle { @@ -260,10 +267,11 @@ resource "flexibleengine_cbr_policy" "test" { time_zone = "UTC+08:00" long_term_retention { - daily = 20 - weekly = 20 - monthly = 6 - yearly = 1 + daily = 20 + weekly = 20 + monthly = 6 + yearly = 1 + full_backup_interval = 5 } backup_cycle { @@ -282,6 +290,7 @@ resource "flexibleengine_cbr_policy" "test" { destination_region = "%s" destination_project_id = "%s" time_period = 20 + enable_acceleration = true backup_cycle { interval = 5