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_db_instance: add new attributes:bursting_enabled and modify sql_collector_config_value #8071

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
22 changes: 21 additions & 1 deletion alicloud/resource_alicloud_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,12 @@ func resourceAliCloudDBInstance() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: IntInSlice([]int{30, 180, 365, 1095, 1825}),
Default: 30,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
if v, ok := d.GetOk("sql_collector_status"); ok && strings.ToLower(v.(string)) == "enabled" {
return false
}
return true
},
},
"resource_group_id": {
Type: schema.TypeString,
Expand Down Expand Up @@ -638,6 +643,10 @@ func resourceAliCloudDBInstance() *schema.Resource {
return d.Get("engine").(string) != "SQLServer"
},
},
"bursting_enabled": {
Type: schema.TypeBool,
Optional: true,
},
},
}
}
Expand Down Expand Up @@ -1455,6 +1464,13 @@ func resourceAliCloudDBInstanceUpdate(d *schema.ResourceData, meta interface{})
}
request["DBInstanceStorage"] = d.Get("instance_storage")

if d.HasChange("bursting_enabled") {
update = true
}
if v, ok := d.GetOkExists("bursting_enabled"); ok {
request["BurstingEnabled"] = v
}

if d.HasChange("serverless_config") {
update = true
if v, ok := d.GetOk("serverless_config"); ok {
Expand Down Expand Up @@ -1814,6 +1830,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"])
d.Set("pg_bouncer_enabled", instance["PGBouncerEnabled"])

// MySQL Serverless instance query PayType return SERVERLESS, need to be consistent with the participant.
Expand Down Expand Up @@ -2075,6 +2092,9 @@ func buildDBCreateRequest(d *schema.ResourceData, meta interface{}) (map[string]
if v, ok := d.GetOk("port"); ok && v.(string) != "" {
request["Port"] = v
}
if v, ok := d.GetOkExists("bursting_enabled"); ok {
request["BurstingEnabled"] = v
}

if request["Engine"] == "MySQL" || request["Engine"] == "PostgreSQL" || request["Engine"] == "SQLServer" {
if v, ok := d.GetOk("role_arn"); ok && v.(string) != "" {
Expand Down
Loading
Loading