-
Notifications
You must be signed in to change notification settings - Fork 559
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 #7840
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不建议显式设置默认值,在tf中,针对bool类型的字段,除非后端返回的是true,否则默认值是false There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 什么意思?如果集成bursting_enabled字段,资源都必须给他赋值为true,才能让实例创建成功吗?如果是,影响存量资源。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已去掉显式默认值设置 |
||
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) != "" { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么删除默认值,并加上压制函数?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为DescribeSQLCollectorRetention接口的返回值有改动,之前没这个参数,现在有该参数的返回值了,导致线上存量实例产生了diff,所以要删除默认值和加上压制函数
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
相关Aone:https://project.aone.alibaba-inc.com/v2/project/629242/bug/61151373