Skip to content

Commit

Permalink
resource/alicloud_hbr_oss_backup_plan: fix bug while leave this prope…
Browse files Browse the repository at this point in the history
…rty empty for field prefix.
  • Loading branch information
ChenHanZhang committed Feb 18, 2024
1 parent 4f6be63 commit 421899a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 1 addition & 3 deletions alicloud/resource_alicloud_hbr_oss_backup_plan.go
Expand Up @@ -200,9 +200,7 @@ func resourceAlicloudHbrOssBackupPlanUpdate(d *schema.ResourceData, meta interfa
}
if !d.IsNewResource() && d.HasChange("prefix") {
update = true
if v, ok := d.GetOk("prefix"); ok {
request["Prefix"] = v
}
request["Prefix"] = d.Get("prefix")
}
if !d.IsNewResource() && d.HasChange("schedule") {
update = true
Expand Down
12 changes: 11 additions & 1 deletion alicloud/resource_alicloud_hbr_oss_backup_plan_test.go
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)

func TestAccAlicloudHBROssBackupPlan_basic0(t *testing.T) {
func TestAccAliCloudHBROssBackupPlan_basic0(t *testing.T) {
var v map[string]interface{}
resourceId := "alicloud_hbr_oss_backup_plan.default"
ra := resourceAttrInit(resourceId, AlicloudHBROssBackupPlanMap0)
Expand Down Expand Up @@ -123,6 +123,16 @@ func TestAccAlicloudHBROssBackupPlan_basic0(t *testing.T) {
}),
),
},
{
Config: testAccConfig(map[string]interface{}{
"prefix": REMOVEKEY,
}),
Check: resource.ComposeTestCheckFunc(
testAccCheck(map[string]string{
"prefix": "",
}),
),
},
{
Config: testAccConfig(map[string]interface{}{
"oss_backup_plan_name": "tf-testAccHbrOss3",
Expand Down

0 comments on commit 421899a

Please sign in to comment.