Skip to content

Commit 60be647

Browse files
authored
Revert "fix(dnspod): [123456789] weight set zero (#3460)" (#3466)
This reverts commit 1c70fc2.
1 parent affb4af commit 60be647

File tree

5 files changed

+5
-115
lines changed

5 files changed

+5
-115
lines changed

.changelog/3460.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

schema/metadata.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
provider_meta:
22
metadata:
33
display_name: 腾讯云资源
4-
icon_url: tencentcloud
54
attr_orders:
65
- name: domain
76
- name: profile

tencentcloud/services/dnspod/resource_tc_dnspod_record.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ func ResourceTencentCloudDnspodRecord() *schema.Resource {
6969
"weight": {
7070
Type: schema.TypeInt,
7171
Optional: true,
72-
Description: "Weight information. An integer from 0 to 100. Only enterprise VIP domain names are available, 0 means off, does not pass this parameter, means that the weight information is not set.",
72+
Default: 0,
73+
Description: "Weight information. An integer from 0 to 100. Only enterprise VIP domain names are available, 0 means off, does not pass this parameter, means that the weight information is not set. Default is 0.",
7374
},
7475
"status": {
7576
Type: schema.TypeString,
@@ -117,7 +118,7 @@ func resourceTencentCloudDnspodRecordCreate(d *schema.ResourceData, meta interfa
117118
request.MX = helper.IntUint64(v.(int))
118119
}
119120
request.TTL = helper.IntUint64(ttl)
120-
if v, ok := d.GetOkExists("weight"); ok {
121+
if v, ok := d.GetOk("weight"); ok {
121122
request.Weight = helper.IntUint64(v.(int))
122123
}
123124
request.Status = &status
@@ -268,7 +269,7 @@ func resourceTencentCloudDnspodRecordUpdate(d *schema.ResourceData, meta interfa
268269
ttl := v.(int)
269270
request.TTL = helper.IntUint64(ttl)
270271
}
271-
if v, ok := d.GetOkExists("weight"); ok {
272+
if v, ok := d.GetOk("weight"); ok {
272273
weight := v.(int)
273274
request.Weight = helper.IntUint64(weight)
274275
}

tencentcloud/services/dnspod/resource_tc_dnspod_record_test.go

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -136,90 +136,6 @@ func TestAccTencentCloudDnspodRecordResource_MX(t *testing.T) {
136136
})
137137
}
138138

139-
func TestAccTencentCloudDnspodRecordResource_WeightZero(t *testing.T) {
140-
t.Parallel()
141-
resource.Test(t, resource.TestCase{
142-
PreCheck: func() { tcacctest.AccPreCheck(t) },
143-
Providers: tcacctest.AccProviders,
144-
CheckDestroy: testAccCheckDnspodRecordDestroy,
145-
Steps: []resource.TestStep{
146-
{
147-
Config: testAccTencentCloudDnspodRecordWeightZero,
148-
Check: resource.ComposeTestCheckFunc(
149-
testAccCheckDnspodRecordExists("tencentcloud_dnspod_record.weight"),
150-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "domain", "tencentcloud-terraform-provider.cn"),
151-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "record_type", "A"),
152-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "record_line", "默认"),
153-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "value", "1.2.3.10"),
154-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "sub_domain", "weight"),
155-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "remark", "terraform-test"),
156-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "weight", "0"),
157-
),
158-
},
159-
{
160-
Config: testAccTencentCloudDnspodRecordWeight,
161-
Check: resource.ComposeTestCheckFunc(
162-
testAccCheckDnspodRecordExists("tencentcloud_dnspod_record.weight"),
163-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "domain", "tencentcloud-terraform-provider.cn"),
164-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "record_type", "A"),
165-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "record_line", "默认"),
166-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "value", "1.2.3.10"),
167-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "sub_domain", "weight"),
168-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "remark", "terraform-test"),
169-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "weight", "10"),
170-
),
171-
},
172-
{
173-
ResourceName: "tencentcloud_dnspod_record.weight",
174-
ImportState: true,
175-
ImportStateVerify: true,
176-
},
177-
},
178-
})
179-
}
180-
181-
func TestAccTencentCloudDnspodRecordResource_Weight(t *testing.T) {
182-
t.Parallel()
183-
resource.Test(t, resource.TestCase{
184-
PreCheck: func() { tcacctest.AccPreCheck(t) },
185-
Providers: tcacctest.AccProviders,
186-
CheckDestroy: testAccCheckDnspodRecordDestroy,
187-
Steps: []resource.TestStep{
188-
{
189-
Config: testAccTencentCloudDnspodRecordWeight,
190-
Check: resource.ComposeTestCheckFunc(
191-
testAccCheckDnspodRecordExists("tencentcloud_dnspod_record.weight"),
192-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "domain", "tencentcloud-terraform-provider.cn"),
193-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "record_type", "A"),
194-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "record_line", "默认"),
195-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "value", "1.2.3.10"),
196-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "sub_domain", "weight"),
197-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "remark", "terraform-test"),
198-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "weight", "10"),
199-
),
200-
},
201-
{
202-
Config: testAccTencentCloudDnspodRecordWeightZero,
203-
Check: resource.ComposeTestCheckFunc(
204-
testAccCheckDnspodRecordExists("tencentcloud_dnspod_record.weight"),
205-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "domain", "tencentcloud-terraform-provider.cn"),
206-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "record_type", "A"),
207-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "record_line", "默认"),
208-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "value", "1.2.3.10"),
209-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "sub_domain", "weight"),
210-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "remark", "terraform-test"),
211-
resource.TestCheckResourceAttr("tencentcloud_dnspod_record.weight", "weight", "0"),
212-
),
213-
},
214-
{
215-
ResourceName: "tencentcloud_dnspod_record.weight",
216-
ImportState: true,
217-
ImportStateVerify: true,
218-
},
219-
},
220-
})
221-
}
222-
223139
func testAccCheckDnspodRecordExists(n string) resource.TestCheckFunc {
224140
return func(s *terraform.State) error {
225141
rs, ok := s.RootModule().Resources[n]
@@ -371,26 +287,3 @@ resource "tencentcloud_dnspod_record" "demo" {
371287
remark = "terraform-test"
372288
}
373289
`
374-
375-
const testAccTencentCloudDnspodRecordWeightZero = `
376-
resource "tencentcloud_dnspod_record" "weight" {
377-
domain="tencentcloud-terraform-provider.cn"
378-
record_type="A"
379-
record_line="默认"
380-
value="1.2.3.10"
381-
sub_domain="weight"
382-
remark="terraform-test"
383-
weight=0
384-
}
385-
`
386-
const testAccTencentCloudDnspodRecordWeight = `
387-
resource "tencentcloud_dnspod_record" "weight" {
388-
domain="tencentcloud-terraform-provider.cn"
389-
record_type="A"
390-
record_line="默认"
391-
value="1.2.3.10"
392-
sub_domain="weight"
393-
remark="terraform-test"
394-
weight=10
395-
}
396-
`

website/docs/r/dnspod_record.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The following arguments are supported:
3838
* `status` - (Optional, String) Records the initial state, with values ranging from ENABLE and DISABLE. The default is ENABLE, and if DISABLE is passed in, resolution will not take effect and the limits of load balancing will not be verified.
3939
* `sub_domain` - (Optional, String) The host records, default value is `@`.
4040
* `ttl` - (Optional, Int) TTL, the range is 1-604800, and the minimum value of different levels of domain names is different. Default is 600.
41-
* `weight` - (Optional, Int) Weight information. An integer from 0 to 100. Only enterprise VIP domain names are available, 0 means off, does not pass this parameter, means that the weight information is not set.
41+
* `weight` - (Optional, Int) Weight information. An integer from 0 to 100. Only enterprise VIP domain names are available, 0 means off, does not pass this parameter, means that the weight information is not set. Default is 0.
4242

4343
## Attributes Reference
4444

0 commit comments

Comments
 (0)