diff --git a/alicloud/resource_alicloud_db_instance.go b/alicloud/resource_alicloud_db_instance.go index 017bfd9d404a..55cad834ce7a 100644 --- a/alicloud/resource_alicloud_db_instance.go +++ b/alicloud/resource_alicloud_db_instance.go @@ -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, @@ -638,6 +643,10 @@ func resourceAliCloudDBInstance() *schema.Resource { return d.Get("engine").(string) != "SQLServer" }, }, + "bursting_enabled": { + Type: schema.TypeBool, + Optional: true, + }, }, } } @@ -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 { @@ -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. @@ -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) != "" { diff --git a/alicloud/resource_alicloud_db_instance_test.go b/alicloud/resource_alicloud_db_instance_test.go index c0549d5e7bb7..5c74a0d04ed6 100644 --- a/alicloud/resource_alicloud_db_instance_test.go +++ b/alicloud/resource_alicloud_db_instance_test.go @@ -227,6 +227,7 @@ func TestAccAliCloudRdsDBInstance_Mysql_8_0(t *testing.T) { "db_instance_storage_type": "cloud_ssd", "resource_group_id": "${data.alicloud_resource_manager_resource_groups.default.ids.0}", "db_is_ignore_case": "false", + "bursting_enabled": "true", }), Check: resource.ComposeTestCheckFunc( testAccCheck(map[string]string{ @@ -238,6 +239,27 @@ func TestAccAliCloudRdsDBInstance_Mysql_8_0(t *testing.T) { "auto_upgrade_minor_version": "Auto", "db_instance_storage_type": "cloud_ssd", "resource_group_id": CHECKSET, + "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{}{ + "bursting_enabled": "true", + }), + Check: resource.ComposeTestCheckFunc( + testAccCheck(map[string]string{ + "bursting_enabled": "true", }), ), }, diff --git a/website/docs/r/db_instance.html.markdown b/website/docs/r/db_instance.html.markdown index faed6de072bc..17c397eab860 100644 --- a/website/docs/r/db_instance.html.markdown +++ b/website/docs/r/db_instance.html.markdown @@ -770,7 +770,10 @@ The following arguments are supported: -> **NOTE:** This parameter is not required when you create an instance that runs MySQL, PostgreSQL, or SQL Server. You need to only specify the RoleARN parameter to create an instance that has cloud disk encryption enabled by using the obtained key ID. You can configure RAM authorization to require a RAM user to enable cloud disk encryption when the RAM user is used to create an instance. If cloud disk encryption is disabled during the instance creation, the creation operation fails. To complete the configuration, you can attach the following policy to the RAM user: {"Version":"1","Statement":[{"Effect":"Deny","Action":"rds:CreateDBInstance","Resource":"*","Condition":{"StringEquals":{"rds:DiskEncryptionRequired":"false"}}}]} * `direction` - (Optional, Available since v1.209.1) The instance configuration type. Valid values: ["Up", "Down", "TempUpgrade", "Serverless"] - +* `bursting_enabled` - (Optional, Available since 1.238.0) Specifies whether to enable the I/O burst feature of general + ESSDs. Valid values: + - true + - false * `node_id` - (Optional, Available since v1.213.1) The globally unique identifier (GUID) of the secondary instance. You can call the DescribeDBInstanceHAConfig operation to query the GUID of the secondary instance. * `force` - (Optional, ForceNew, Available since v1.213.1) Specifies whether to enable forcible switching. Valid values: