Skip to content

Commit

Permalink
resource/alicloud_db_instance:fix_Account_Modification
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitiansheng0524 committed Nov 12, 2024
1 parent 7041708 commit 34cb10e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
11 changes: 11 additions & 0 deletions alicloud/resource_alicloud_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,11 @@ func resourceAliCloudDBInstance() *schema.Resource {
Optional: true,
ValidateFunc: StringInSlice([]string{"Up", "Down", "TempUpgrade", "Serverless"}, false),
},
"bursting_enabled": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
},
}
}
Expand Down Expand Up @@ -1423,6 +1428,11 @@ func resourceAliCloudDBInstanceUpdate(d *schema.ResourceData, meta interface{})
}
request["DBInstanceStorage"] = d.Get("instance_storage")

if d.HasChange("bursting_enabled") {
update = true
}
request["BurstingEnabled"] = d.Get("bursting_enabled")

if d.HasChange("serverless_config") {
update = true
if v, ok := d.GetOk("serverless_config"); ok {
Expand Down Expand Up @@ -1708,6 +1718,7 @@ func resourceAliCloudDBInstanceRead(d *schema.ResourceData, meta interface{}) er
d.Set("zone_id", instance["ZoneId"])
d.Set("status", instance["DBInstanceStatus"])
d.Set("create_time", instance["CreationTime"])
d.Set("bursting_enabled", instance["BurstingEnabled"])

// MySQL Serverless instance query PayType return SERVERLESS, need to be consistent with the participant.
payType := instance["PayType"]
Expand Down
20 changes: 20 additions & 0 deletions alicloud/resource_alicloud_db_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,26 @@ func TestAccAliCloudRdsDBInstance_Mysql_8_0(t *testing.T) {
}),
),
},
{
Config: testAccConfig(map[string]interface{}{
"bursting_enabled": "true",
}),
Check: resource.ComposeTestCheckFunc(
testAccCheck(map[string]string{
"bursting_enabled": "true",
}),
),
},
{
Config: testAccConfig(map[string]interface{}{
"bursting_enabled": "false",
}),
Check: resource.ComposeTestCheckFunc(
testAccCheck(map[string]string{
"bursting_enabled": "false",
}),
),
},
{
Config: testAccConfig(map[string]interface{}{
"db_instance_storage_type": "cloud_essd",
Expand Down
4 changes: 2 additions & 2 deletions alicloud/resource_alicloud_rds_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ func resourceAlicloudRdsAccount() *schema.Resource {
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z][a-z0-9_]{0,61}[a-z0-9]$`), "The name can consist of lowercase letters, numbers, underscores, and must begin with letters and end with letters or numbers"),
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_]{0,61}[a-zA-Z0-9]$`), "The name can consist of letters, numbers, underscores, and must begin with letters and end with letters or numbers"),
ConflictsWith: []string{"name"},
},
"name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-z][a-z0-9_]{0,61}[a-z0-9]$`), "The name can consist of lowercase letters, numbers, underscores, and must begin with letters and end with letters or numbers"),
ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_]{0,61}[a-zA-Z0-9]$`), "The name can consist of letters, numbers, underscores, and must begin with letters and end with letters or numbers"),
Deprecated: "Field 'name' has been deprecated from provider version 1.120.0. New field 'account_name' instead.",
ConflictsWith: []string{"account_name"},
},
Expand Down

0 comments on commit 34cb10e

Please sign in to comment.