Skip to content

Commit faa5fb8

Browse files
committed
Fix terraform 12 syntax in testacc:
- network_interface - hosts - forwarders
1 parent a9d0192 commit faa5fb8

File tree

3 files changed

+41
-49
lines changed

3 files changed

+41
-49
lines changed

libvirt/resource_libvirt_domain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/dmacvicar/terraform-provider-libvirt/libvirt/helper/suppress"
1414
"github.com/hashicorp/terraform/helper/schema"
1515
libvirt "github.com/libvirt/libvirt-go"
16-
"github.com/libvirt/libvirt-go-xml"
16+
libvirtxml "github.com/libvirt/libvirt-go-xml"
1717
)
1818

1919
type pendingMapping struct {

libvirt/resource_libvirt_domain_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,10 @@ func TestAccLibvirtDomain_NetworkInterface(t *testing.T) {
458458
459459
resource "libvirt_domain" "%s" {
460460
name = "%s"
461-
network_interface = {
461+
network_interface {
462462
network_name = "default"
463463
}
464-
network_interface = {
464+
network_interface {
465465
network_name = "default"
466466
mac = "52:54:00:A9:F5:17"
467467
wait_for_lease = true

libvirt/resource_libvirt_network_test.go

Lines changed: 38 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"github.com/hashicorp/terraform/helper/acctest"
88
"github.com/hashicorp/terraform/helper/resource"
99
"github.com/hashicorp/terraform/terraform"
10-
"github.com/libvirt/libvirt-go"
11-
"github.com/libvirt/libvirt-go-xml"
10+
libvirt "github.com/libvirt/libvirt-go"
11+
libvirtxml "github.com/libvirt/libvirt-go-xml"
1212
)
1313

1414
func TestAccLibvirtNetwork_Addresses(t *testing.T) {
@@ -134,18 +134,16 @@ func TestAccLibvirtNetwork_DNSForwarders(t *testing.T) {
134134
domain = "k8s.local"
135135
addresses = ["10.17.3.0/24"]
136136
dns {
137-
forwarders = [
138-
{
139-
address = "8.8.8.8",
140-
},
141-
{
142-
address = "10.10.0.67",
143-
domain = "my.domain.com",
144-
},
145-
{
146-
domain = "hello.com",
147-
},
148-
]
137+
forwarders {
138+
address = "8.8.8.8"
139+
}
140+
forwarders {
141+
address = "10.10.0.67"
142+
domain = "my.domain.com"
143+
}
144+
forwarders {
145+
domain = "hello.com"
146+
}
149147
}
150148
}`, randomNetworkResource, randomNetworkName),
151149
Check: resource.ComposeTestCheckFunc(
@@ -187,20 +185,18 @@ func TestAccLibvirtNetwork_DNSHosts(t *testing.T) {
187185
domain = "k8s.local"
188186
addresses = ["10.17.3.0/24"]
189187
dns {
190-
hosts = [
191-
{
192-
hostname = "myhost1",
193-
ip = "1.1.1.1",
194-
},
195-
{
196-
hostname = "myhost1",
197-
ip = "1.1.1.2",
198-
},
199-
{
200-
hostname = "myhost2",
201-
ip = "1.1.1.1",
202-
},
203-
]
188+
hosts {
189+
hostname = "myhost1"
190+
ip = "1.1.1.1"
191+
}
192+
hosts {
193+
hostname = "myhost1"
194+
ip = "1.1.1.2"
195+
}
196+
hosts {
197+
hostname = "myhost2"
198+
ip = "1.1.1.1"
199+
}
204200
}
205201
}`, randomNetworkResource, randomNetworkName),
206202
Check: resource.ComposeTestCheckFunc(
@@ -234,12 +230,10 @@ func TestAccLibvirtNetwork_DNSHosts(t *testing.T) {
234230
domain = "k8s.local"
235231
addresses = ["10.17.3.0/24"]
236232
dns {
237-
hosts = [
238-
{
239-
hostname = "myhost1",
240-
ip = "1.1.1.1",
241-
},
242-
]
233+
hosts {
234+
hostname = "myhost1"
235+
ip = "1.1.1.1"
236+
}
243237
}
244238
}`, randomNetworkResource, randomNetworkName),
245239
Check: resource.ComposeTestCheckFunc(
@@ -262,23 +256,21 @@ func TestAccLibvirtNetwork_DNSHosts(t *testing.T) {
262256
domain = "k8s.local"
263257
addresses = ["10.17.3.0/24"]
264258
dns {
265-
hosts = [
266-
{
267-
hostname = "myhost1",
268-
ip = "1.1.1.1",
269-
},
259+
hosts {
260+
hostname = "myhost1"
261+
ip = "1.1.1.1"
262+
}
270263
# Without https:#www.redhat.com/archives/libvir-list/2018-November/msg00231.html, this raises:
271264
#
272265
# update DNS hosts: add {{ } 1.1.1.2 [{myhost1}]}: virError(Code=55, Domain=19, Message='Requested operation is not valid: there is already at least one DNS HOST record with a matching field in network fo64d9y6w9')
273266
# {
274-
# hostname = "myhost1",
275-
# ip = "1.1.1.2",
267+
# hostname = "myhost1"
268+
# ip = "1.1.1.2"
276269
# },
277-
{
278-
hostname = "myhost2",
279-
ip = "1.1.1.1",
280-
},
281-
]
270+
hosts {
271+
hostname = "myhost2"
272+
ip = "1.1.1.1"
273+
}
282274
}
283275
}`, randomNetworkResource, randomNetworkName),
284276
Check: resource.ComposeTestCheckFunc(

0 commit comments

Comments
 (0)