Skip to content

Commit 6acb0ef

Browse files
committed
Merge branch 'v3.18xR' into ld_0120
2 parents 74bdbc8 + 87a5bae commit 6acb0ef

File tree

2 files changed

+35
-74
lines changed

2 files changed

+35
-74
lines changed

alibabacloudstack/resource_apsarastack_db_readonly_instance.go

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -39,62 +39,62 @@ func resourceAlibabacloudStackDBReadonlyInstance() *schema.Resource {
3939
},
4040

4141
"master_db_instance_id": {
42-
Type: schema.TypeString,
43-
Optional:true,
44-
Computed:true,
45-
ForceNew: true,
46-
Deprecated: "Field 'master_db_instance_id' is deprecated and will be removed in a future release. Please use new field 'master_instance_id' instead.",
42+
Type: schema.TypeString,
43+
Optional: true,
44+
Computed: true,
45+
ForceNew: true,
46+
Deprecated: "Field 'master_db_instance_id' is deprecated and will be removed in a future release. Please use new field 'master_instance_id' instead.",
4747
ConflictsWith: []string{"master_instance_id"},
4848
},
4949
"master_instance_id": {
50-
Type: schema.TypeString,
51-
Optional:true,
52-
Computed:true,
53-
ForceNew: true,
50+
Type: schema.TypeString,
51+
Optional: true,
52+
Computed: true,
53+
ForceNew: true,
5454
ConflictsWith: []string{"master_db_instance_id"},
5555
},
5656

5757
"instance_name": {
58-
Type: schema.TypeString,
59-
Optional: true,
60-
ValidateFunc: validation.StringLenBetween(2, 256),
61-
Computed: true,
62-
Deprecated: "Field 'instance_name' is deprecated and will be removed in a future release. Please use new field 'db_instance_description' instead.",
58+
Type: schema.TypeString,
59+
Optional: true,
60+
ValidateFunc: validation.StringLenBetween(2, 256),
61+
Computed: true,
62+
Deprecated: "Field 'instance_name' is deprecated and will be removed in a future release. Please use new field 'db_instance_description' instead.",
6363
ConflictsWith: []string{"db_instance_description"},
6464
},
6565
"db_instance_description": {
66-
Type: schema.TypeString,
67-
Optional: true,
68-
ValidateFunc: validation.StringLenBetween(2, 256),
69-
Computed: true,
66+
Type: schema.TypeString,
67+
Optional: true,
68+
ValidateFunc: validation.StringLenBetween(2, 256),
69+
Computed: true,
7070
ConflictsWith: []string{"instance_name"},
7171
},
7272

7373
"instance_type": {
74-
Type: schema.TypeString,
75-
Optional:true,
76-
Computed:true,
77-
Deprecated: "Field 'instance_type' is deprecated and will be removed in a future release. Please use new field 'db_instance_class' instead.",
74+
Type: schema.TypeString,
75+
Optional: true,
76+
Computed: true,
77+
Deprecated: "Field 'instance_type' is deprecated and will be removed in a future release. Please use new field 'db_instance_class' instead.",
7878
ConflictsWith: []string{"db_instance_class"},
7979
},
8080
"db_instance_class": {
81-
Type: schema.TypeString,
82-
Optional:true,
83-
Computed:true,
81+
Type: schema.TypeString,
82+
Optional: true,
83+
Computed: true,
8484
ConflictsWith: []string{"instance_type"},
8585
},
8686

8787
"instance_storage": {
88-
Type: schema.TypeInt,
89-
Optional:true,
90-
Computed:true,
91-
Deprecated: "Field 'instance_storage' is deprecated and will be removed in a future release. Please use new field 'db_instance_storage' instead.",
88+
Type: schema.TypeInt,
89+
Optional: true,
90+
Computed: true,
91+
Deprecated: "Field 'instance_storage' is deprecated and will be removed in a future release. Please use new field 'db_instance_storage' instead.",
9292
ConflictsWith: []string{"db_instance_storage"},
9393
},
9494
"db_instance_storage": {
95-
Type: schema.TypeInt,
96-
Optional:true,
97-
Computed:true,
95+
Type: schema.TypeInt,
96+
Optional: true,
97+
Computed: true,
9898
ConflictsWith: []string{"instance_storage"},
9999
},
100100

@@ -144,7 +144,6 @@ func resourceAlibabacloudStackDBReadonlyInstance() *schema.Resource {
144144
Type: schema.TypeString,
145145
Computed: true,
146146
},
147-
148147
"port": {
149148
Type: schema.TypeString,
150149
Computed: true,
@@ -210,7 +209,7 @@ func resourceAlibabacloudStackDBReadonlyInstanceUpdate(d *schema.ResourceData, m
210209

211210
if d.IsNewResource() {
212211
d.Partial(false)
213-
return resourceAlibabacloudStackDBInstanceRead(d, meta)
212+
return resourceAlibabacloudStackDBReadonlyInstanceRead(d, meta)
214213
}
215214

216215
if d.HasChanges("db_instance_description", "instance_name") {
@@ -438,7 +437,7 @@ func buildDBReadonlyCreateRequest(d *schema.ResourceData, meta interface{}) (*rd
438437
}
439438
request.DBInstanceClass = Trim(connectivity.GetResourceData(d, "db_instance_class", "instance_type").(string))
440439
if err := errmsgs.CheckEmpty(request.DBInstanceClass, schema.TypeString, "db_instance_class", "instance_type"); err != nil {
441-
return request, errmsgs.WrapError(err)
440+
return request, errmsgs.WrapError(err)
442441
}
443442
request.DBInstanceDescription = connectivity.GetResourceData(d, "db_instance_description", "instance_name").(string)
444443
request.DBInstanceStorageType = d.Get("db_instance_storage_type").(string)

alibabacloudstack/resource_apsarastack_db_readonly_instance_test.go

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import (
44
"fmt"
55
"testing"
66

7-
8-
97
"github.com/aliyun/alibaba-cloud-sdk-go/services/rds"
108
"github.com/aliyun/terraform-provider-alibabacloudstack/alibabacloudstack/connectivity"
119
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -17,13 +15,12 @@ func TestAccAlibabacloudStackDBReadonlyInstance_update(t *testing.T) {
1715
rand := getAccTestRandInt(10000, 99999)
1816
name := fmt.Sprintf("tf-testAccDBInstance_vpc_%d", rand)
1917
var DBReadonlyMap = map[string]string{
20-
"instance_storage": "5",
18+
"instance_storage": "20",
2119
"engine_version": "5.6",
2220
"engine": "MySQL",
2321
"port": "3306",
2422
"instance_name": name,
2523
"instance_type": CHECKSET,
26-
"parameters": NOSET,
2724
"master_db_instance_id": CHECKSET,
2825
"zone_id": CHECKSET,
2926
"vswitch_id": CHECKSET,
@@ -69,24 +66,6 @@ func TestAccAlibabacloudStackDBReadonlyInstance_update(t *testing.T) {
6966
ImportState: true,
7067
ImportStateVerify: true,
7168
},
72-
// upgrade storage
73-
{
74-
Config: testAccConfig(map[string]interface{}{
75-
"instance_storage": "${alibabacloudstack_db_instance.default.instance_storage + data.alibabacloudstack_db_instance_classes.default.instance_classes.0.storage_range.step}",
76-
}),
77-
Check: resource.ComposeTestCheckFunc(
78-
testAccCheck(map[string]string{"instance_storage": "10"}),
79-
),
80-
},
81-
// upgrade instanceType
82-
{
83-
Config: testAccConfig(map[string]interface{}{
84-
"instance_type": "${data.alibabacloudstack_db_instance_classes.default.instance_classes.1.instance_class}",
85-
}),
86-
Check: resource.ComposeTestCheckFunc(
87-
testAccCheck(map[string]string{"instance_type": CHECKSET}),
88-
),
89-
},
9069
{
9170
Config: testAccConfig(map[string]interface{}{
9271
"instance_name": "${var.name}_ro",
@@ -124,23 +103,6 @@ func TestAccAlibabacloudStackDBReadonlyInstance_update(t *testing.T) {
124103
}),
125104
),
126105
},
127-
{
128-
Config: testAccConfig(map[string]interface{}{
129-
"master_db_instance_id": "${alibabacloudstack_db_instance.default.id}",
130-
"zone_id": "${alibabacloudstack_db_instance.default.zone_id}",
131-
"engine_version": "${alibabacloudstack_db_instance.default.engine_version}",
132-
"instance_type": "${alibabacloudstack_db_instance.default.instance_type}",
133-
"instance_storage": "${alibabacloudstack_db_instance.default.instance_storage + 2*data.alibabacloudstack_db_instance_classes.default.instance_classes.0.storage_range.step}",
134-
"instance_name": "${var.name}",
135-
"vswitch_id": "${alibabacloudstack_vpc_vswitch.default.id}",
136-
}),
137-
Check: resource.ComposeTestCheckFunc(
138-
testAccCheck(map[string]string{
139-
"instance_name": name,
140-
"instance_storage": "15",
141-
}),
142-
),
143-
},
144106
},
145107
})
146108

0 commit comments

Comments
 (0)