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

resource/alicloud_hbr_oss_backup_plan: fix bug while leave this property empty for field prefix. #6975

Merged
merged 1 commit into from Feb 18, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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