Skip to content

Commit

Permalink
feat(cbr/policy): enable_acceleration is an internal param now (#6084)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lance52259 authored Dec 24, 2024
1 parent 68dcbb7 commit 5ca869e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 31 deletions.
22 changes: 0 additions & 22 deletions docs/resources/cbr_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ The following arguments are supported:
* `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 @@ -152,21 +148,3 @@ Policies can be imported by their `id`, e.g.
```bash
$ terraform import huaweicloud_cbr_policy.test <id>
```

Note that the imported state may not be identical to your resource definition, due to the attribute missing from the
API response. The missing attribute is: `enable_acceleration`.
It is generally recommended running `terraform plan` after importing a policy.
You can then decide if changes should be applied to the policy, or the resource definition should be updated to align
with the policy. Also you can ignore changes as below.

```hcl
resource "huaweicloud_cbr_policy" "test" {
...
lifecycle {
ignore_changes = [
enable_acceleration,
]
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ func TestAccPolicy_replication(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "destination_region", acceptance.HW_DEST_REGION),
resource.TestCheckResourceAttr(resourceName, "destination_project_id", acceptance.HW_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 @@ -278,7 +277,6 @@ resource "huaweicloud_cbr_policy" "test" {
destination_region = "%[2]s"
destination_project_id = "%[3]s"
time_period = 20
enable_acceleration = true
backup_cycle {
interval = 5
Expand Down
18 changes: 11 additions & 7 deletions huaweicloud/services/cbr/resource_huaweicloud_cbr_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,6 @@ func ResourcePolicy() *schema.Resource {
Optional: true,
Description: "The name of the replication destination region.",
},
"enable_acceleration": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Description: "Whether to enable the acceleration function to shorten the replication time for " +
"cross-region",
},
"destination_project_id": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -174,6 +167,17 @@ func ResourcePolicy() *schema.Resource {
"The time zone must be in UTC format, such as 'UTC+08:00'."),
Description: "The UTC time zone.",
},
"enable_acceleration": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Description: utils.SchemaDesc(
"Whether to enable the acceleration function to shorten the replication time for cross-region",
utils.SchemaDescInput{
Internal: true,
},
),
},
},
}
}
Expand Down

0 comments on commit 5ca869e

Please sign in to comment.