Skip to content

Commit d027573

Browse files
fix: network-instance configured DNS servers are not sent to Zedcloud(CI-574) (#145)
The issue was that the configured DNS servers were not sent to the network instances' create request. Changes: Fixed the dns field in the dhcp_server schema. Updated tests to test the dns field.
1 parent 6f88cb3 commit d027573

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

v2/resources/testdata/network_instance/create_complete.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@ resource "zedcloud_network_instance" "complete" {
140140
}
141141
mask = "255.255.255.0"
142142
ntp = "10.1.0.2"
143+
dns = [
144+
"9.9.9.9",
145+
"8.8.8.8",
146+
"7.7.7.7",
147+
"6.6.6.6",
148+
"5.5.5.5",
149+
"4.4.4.4",
150+
"3.3.3.3"
151+
]
143152
}
144153
opaque {
145154
oconfig = "Test OConfig"

v2/resources/testdata/network_instance/create_complete_expected.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ ip:
1818
dhcprange:
1919
end: "10.0.20.100"
2020
start: "10.0.20.50"
21-
dns: []
21+
dns:
22+
- "9.9.9.9"
23+
- "8.8.8.8"
24+
- "7.7.7.7"
25+
- "6.6.6.6"
26+
- "5.5.5.5"
27+
- "4.4.4.4"
28+
- "3.3.3.3"
2229
mask: "255.255.255.0"
2330
ntp: "10.1.0.2"
2431
kind: NETWORK_INSTANCE_KIND_LOCAL

v2/schemas/dhcp_server.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func DHCPServerModel(d *schema.ResourceData) *models.DhcpServerConfig {
1919
if dnsIsSet {
2020
dnsSlice := dnsInterface.([]interface{})
2121
for _, i := range dnsSlice {
22-
dnsSlice = append(dnsSlice, i.(string))
22+
dns = append(dns, i.(string))
2323
}
2424
}
2525
domain, _ := d.Get("domain").(string)
@@ -53,7 +53,7 @@ func DHCPServerModelFromMap(m map[string]interface{}) *models.DhcpServerConfig {
5353
if dnsIsSet {
5454
dnsSlice := dnsInterface.([]interface{})
5555
for _, i := range dnsSlice {
56-
dnsSlice = append(dnsSlice, i.(string))
56+
dns = append(dns, i.(string))
5757
}
5858
}
5959
domain, _ := m["domain"].(string)
@@ -117,8 +117,7 @@ func DHCPServer() map[string]*schema.Schema {
117117
Elem: &schema.Schema{
118118
Type: schema.TypeString,
119119
},
120-
DiffSuppressFunc: diffSuppressDNSListOrder("dns"),
121-
Optional: true,
120+
Optional: true,
122121
},
123122

124123
"domain": {

0 commit comments

Comments
 (0)