Skip to content

Commit 655b7aa

Browse files
committed
fix bugs
1 parent 2461d9c commit 655b7aa

File tree

4 files changed

+7
-16
lines changed

4 files changed

+7
-16
lines changed

tencentcloud/data_source_tc_sqlserver_dbs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ func dataSourceTencentSqlserverDBRead(d *schema.ResourceData, meta interface{})
9393
if !has {
9494
return fmt.Errorf("[CRITAL]%s SQL Server instance %s dose not exist", logId, instanceId)
9595
}
96-
_ = d.Set("instance_id", instanceId)
9796

9897
dbInfos, err := sqlserverService.DescribeDBsOfInstance(ctx, instanceId)
9998
if err != nil {

tencentcloud/data_source_tc_sqlserver_instances.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -164,25 +164,16 @@ func dataSourceTencentCloudSqlserverInstanceRead(d *schema.ResourceData, meta in
164164

165165
service := SqlserverService{client: meta.(*TencentCloudClient).apiV3Conn}
166166

167-
id := ""
168-
if v, ok := d.GetOk("id"); ok {
169-
id = v.(string)
170-
}
167+
id := d.Get("id").(string)
171168

172169
project_id := -1
173170
if v, ok := d.GetOk("project_id"); ok {
174171
project_id = v.(int)
175172
}
176173

177-
vpc_id := ""
178-
if v, ok := d.GetOk("vpc_id"); ok {
179-
vpc_id = v.(string)
180-
}
174+
vpc_id := d.Get("vpc_id").(string)
181175

182-
subnet_id := ""
183-
if v, ok := d.GetOk("subnet_id"); ok {
184-
subnet_id = v.(string)
185-
}
176+
subnet_id := d.Get("subnet_id").(string)
186177

187178
instanceList, err := service.DescribeSqlserverInstances(ctx, id, project_id, vpc_id, subnet_id, 0)
188179

tencentcloud/resource_tc_sqlserver_instance.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,20 @@ func resourceTencentCloudSqlserverInstance() *schema.Resource {
144144
"maintenance_week_set": {
145145
Type: schema.TypeSet,
146146
Optional: true,
147+
Computed: true,
147148
Elem: &schema.Schema{Type: schema.TypeInt},
148149
Description: "A list of integer indicates weekly maintenance. For example, [2,7] presents do weekly maintenance on every Tuesday and Sunday.",
149150
},
150151
"maintenance_start_time": {
151152
Type: schema.TypeString,
152153
Optional: true,
153-
Default: "",
154+
Computed: true,
154155
Description: "Start time of the maintenance in one day, format like `HH:mm`.",
155156
},
156157
"maintenance_time_span": {
157158
Type: schema.TypeInt,
158159
Optional: true,
159-
Default: 0,
160+
Computed: true,
160161
Description: "The timespan of maintenance in one day, unit is hour.",
161162
},
162163
"project_id": {

tencentcloud/service_tencentcloud_sqlserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ func (me *SqlserverService) DescribeSqlserverInstanceById(ctx context.Context, i
377377
if len(instanceList) == 0 {
378378
return
379379
} else if len(instanceList) > 1 {
380-
errRet = fmt.Errorf("[DescribeDBInstances]SDK returns more than one instance with instanceId %s", instanceId)
380+
errRet = fmt.Errorf("[DescribeDBInstanceById]SDK returns more than one instance with instanceId %s", instanceId)
381381
}
382382

383383
instance = instanceList[0]

0 commit comments

Comments
 (0)