Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(cbr): add some fields for CBR #1085

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/resources/cbr_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**.

Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down Expand Up @@ -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"),
Expand All @@ -141,6 +144,9 @@ func TestAccCBRV3Policy_replication(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"enable_acceleration",
},
},
},
})
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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
Expand Down
Loading