Skip to content

Commit 79a1952

Browse files
authored
fix(dns/recordset): change the 'records' parameter type from list to set (#6582)
1 parent a350471 commit 79a1952

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

huaweicloud/services/acceptance/dns/resource_huaweicloud_dns_recordset_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func TestAccDNSRecordset_basic(t *testing.T) {
9191
resource.TestCheckResourceAttr(rName, "description", "a recordset description"),
9292
resource.TestCheckResourceAttr(rName, "status", "ENABLE"),
9393
resource.TestCheckResourceAttr(rName, "ttl", "300"),
94-
resource.TestCheckResourceAttr(rName, "records.0", "10.1.0.0"),
94+
resource.TestCheckResourceAttr(rName, "records.#", "2"),
9595
resource.TestCheckResourceAttr(rName, "line_id", "Dianxin_Shanxi"),
9696
resource.TestCheckResourceAttr(rName, "weight", "3"),
9797
resource.TestCheckResourceAttr(rName, "tags.key1", "value1"),
@@ -277,7 +277,7 @@ resource "huaweicloud_dns_recordset" "test" {
277277
description = "a recordset description"
278278
status = "ENABLE"
279279
ttl = 300
280-
records = ["10.1.0.0"]
280+
records = ["10.1.0.0", "9.1.0.0"]
281281
line_id = "Dianxin_Shanxi"
282282
weight = 3
283283

huaweicloud/services/dns/resource_huaweicloud_dns_recordset.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func ResourceDNSRecordset() *schema.Resource {
7575
Description: `The type of the record set.`,
7676
},
7777
"records": {
78-
Type: schema.TypeList,
78+
Type: schema.TypeSet,
7979
Elem: &schema.Schema{Type: schema.TypeString},
8080
MinItems: 1,
8181
Required: true,
@@ -233,7 +233,7 @@ func buildCreateDNSRecordsetBodyParams(d *schema.ResourceData) map[string]interf
233233
"type": utils.ValueIgnoreEmpty(d.Get("type")),
234234
"status": utils.ValueIgnoreEmpty(d.Get("status")),
235235
"ttl": utils.ValueIgnoreEmpty(d.Get("ttl")),
236-
"records": utils.ValueIgnoreEmpty(d.Get("records")),
236+
"records": utils.ValueIgnoreEmpty(d.Get("records").(*schema.Set).List()),
237237
"line": utils.ValueIgnoreEmpty(d.Get("line_id")),
238238
"tags": utils.ExpandResourceTagsMap(d.Get("tags").(map[string]interface{})),
239239
"weight": utils.ValueIgnoreEmpty(d.Get("weight")),
@@ -435,7 +435,7 @@ func buildUpdateDNSRecordsetBodyParams(d *schema.ResourceData) map[string]interf
435435
"description": utils.ValueIgnoreEmpty(d.Get("description")),
436436
"type": utils.ValueIgnoreEmpty(d.Get("type")),
437437
"ttl": utils.ValueIgnoreEmpty(d.Get("ttl")),
438-
"records": utils.ValueIgnoreEmpty(d.Get("records")),
438+
"records": utils.ValueIgnoreEmpty(d.Get("records").(*schema.Set).List()),
439439
"weight": utils.ValueIgnoreEmpty(d.Get("weight")),
440440
}
441441
return bodyParams

0 commit comments

Comments
 (0)