Skip to content

Commit 500b512

Browse files
authored
Merge pull request #52 from douwentao/fix_db_instance
fix: db_instance can`t set parameters
2 parents 3ab507f + c005e34 commit 500b512

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

alibabacloudstack/resource_apsarastack_db_instance.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package alibabacloudstack
33
import (
44
"encoding/json"
55
"fmt"
6-
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
7-
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
86
"log"
97
"strings"
108
"time"
119

10+
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
11+
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
12+
1213
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
1314

1415
"github.com/aliyun/terraform-provider-alibabacloudstack/alibabacloudstack/helper/hashcode"
@@ -245,7 +246,7 @@ func resourceAlibabacloudStackDBInstanceCreate(d *schema.ResourceData, meta inte
245246
EncryptionKey := d.Get("encryption_key").(string)
246247
encryption = d.Get("encryption").(bool)
247248
log.Print("Encryption key input")
248-
if EncryptionKey != "" && encryption == true {
249+
if EncryptionKey != "" && encryption {
249250
log.Print("Encryption key condition passed")
250251
req := requests.NewCommonRequest()
251252
req.Method = "POST"
@@ -469,11 +470,11 @@ func resourceAlibabacloudStackDBInstanceUpdate(d *schema.ResourceData, meta inte
469470
d.Partial(true)
470471
stateConf := BuildStateConf([]string{"DBInstanceClassChanging", "DBInstanceNetTypeChanging"}, []string{"Running"}, d.Timeout(schema.TimeoutUpdate), 10*time.Minute, rdsService.RdsDBInstanceStateRefreshFunc(d.Id(), []string{"Deleting"}))
471472

472-
//if d.HasChange("parameters") {
473-
// if err := rdsService.ModifyParameters(d, "parameters"); err != nil {
474-
// return WrapError(err)
475-
// }
476-
//}
473+
if d.HasChange("parameters") {
474+
if err := rdsService.ModifyParameters(d, "parameters"); err != nil {
475+
return WrapError(err)
476+
}
477+
}
477478

478479
if err := rdsService.setInstanceTags(d); err != nil {
479480
return WrapError(err)
@@ -848,9 +849,9 @@ func resourceAlibabacloudStackDBInstanceRead(d *schema.ResourceData, meta interf
848849
d.Set("maintain_time", instance.MaintainTime)
849850
d.Set("storage_type", instance.DBInstanceStorageType)
850851

851-
//if err = rdsService.RefreshParameters(d, "parameters"); err != nil {
852-
// return WrapError(err)
853-
//}
852+
if err = rdsService.RefreshParameters(d, "parameters"); err != nil {
853+
return WrapError(err)
854+
}
854855

855856
if instance.PayType == string(Prepaid) {
856857
request := rds.CreateDescribeInstanceAutoRenewalAttributeRequest()

0 commit comments

Comments
 (0)