Skip to content
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
48 changes: 48 additions & 0 deletions alicloud/resource_alicloud_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,26 @@ func resourceAliCloudDBInstance() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"certificate": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"private_key": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"pass_word": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"db_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"encryption_key": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1101,6 +1121,21 @@ func resourceAliCloudDBInstanceUpdate(d *schema.ResourceData, meta interface{})
}
}

if "SQLServer" == d.Get("engine").(string) {
if v, ok := d.GetOk("certificate"); ok && v.(string) != "" {
request["Certificate"] = v.(string)
}
if v, ok := d.GetOk("private_key"); ok && v.(string) != "" {
request["PrivateKey"] = v.(string)
}
if v, ok := d.GetOk("pass_word"); ok && v.(string) != "" {
request["PassWord"] = v.(string)
}
if v, ok := d.GetOk("db_name"); ok && v.(string) != "" {
request["DBName"] = v.(string)
}
}

response, err := client.RpcPost("Rds", "2014-08-15", action, nil, request, false)
if err != nil {
return WrapErrorf(err, DefaultErrorMsg, d.Id(), action, AlibabaCloudSdkGoERROR)
Expand Down Expand Up @@ -1354,6 +1389,19 @@ func resourceAliCloudDBInstanceUpdate(d *schema.ResourceData, meta interface{})
}
}

if d.Get("engine").(string) == "SQLServer" {
if d.HasChange("certificate") {
if v, ok := d.GetOk("certificate"); ok && v.(string) != "" {
request["Certificate"] = v.(string)
}
}
if d.HasChange("pass_word") {
if v, ok := d.GetOk("pass_word"); ok && v.(string) != "" {
request["PassWord"] = v.(string)
}
}
}

request["ConnectionString"] = instance["ConnectionString"]
if d.HasChange("ssl_connection_string") {
if v, ok := d.GetOk("ssl_connection_string"); ok && v.(string) != "" {
Expand Down
6 changes: 5 additions & 1 deletion website/docs/d/db_instances.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,8 @@ The following attributes are exported in addition to the arguments listed above:
* `sync_status` - The synchronization status.
* `data_sync_time` - The time when the secondary instance completed the synchronization of data from the primary instance. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.
* `node_id` - The ID of the instance.
* `region_id` - The region ID of the instance.
* `region_id` - The region ID of the instance.
* `private_key` -(Available in 1.274.0+) The private key of the certificate.
* `certificate` -(Available in 1.274.0+) The custom certificate.
* `pass_word` -(Available in 1.274.0+) The password of the certificate.
* `db_name` -(Available in 1.274.0+) The name of the database for which you want to enable TDE.
Loading