Skip to content

Commit a1ce0dc

Browse files
committed
Update doc and fix cmdline testacc
update test with new syntax update documentation for cmdline
1 parent 5ca5390 commit a1ce0dc

File tree

2 files changed

+33
-43
lines changed

2 files changed

+33
-43
lines changed

libvirt/resource_libvirt_domain_test.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,18 @@ func TestAccLibvirtDomain_KernelInitrdCmdline(t *testing.T) {
412412
name = "terraform-test-domain"
413413
kernel = "${libvirt_volume.kernel.id}"
414414
initrd = "${libvirt_volume.initrd.id}"
415-
cmdline {
416-
foo = 1
417-
bar = "bye"
418-
}
419-
cmdline {
420-
foo = 2
415+
416+
417+
cmdline = [
418+
{
419+
arg1 = "value1"
420+
}
421+
]
422+
cmdline = [
423+
{
424+
arg1 = "value2"
421425
}
426+
]
422427
}`, randomDomainName)
423428

424429
resource.Test(t, resource.TestCase{

website/docs/r/domain.html.markdown

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@ resource "libvirt_domain" "domain-suse" {
101101
102102
kernel = "${libvirt_volume.kernel.id}"
103103
104-
cmdline {
104+
cmdline = [
105+
{
105106
arg1 = "value1"
106107
arg2 = "value2"
107108
"_" = "rw nosplash"
108-
}
109+
}
110+
]
109111
}
110112
```
111113

@@ -120,48 +122,31 @@ the following examples:
120122
```hcl
121123
resource "libvirt_domain" "my_machine" {
122124
//...
123-
124-
cmdline {
125-
arg1 = "value1"
126-
}
127-
cmdline {
128-
arg2 = "value2"
129-
}
130-
}
125+
cmdline = [
126+
{
127+
foo = "1"
128+
bar = "bye"
129+
},
130+
{
131+
foo = "2"
132+
}
133+
]
131134
```
132135

133136
```hcl
134137
resource "libvirt_domain" "my_machine" {
135138
...
136-
cmdline = [
137-
{
138-
arg1 = "value1"
139-
},
140-
{
141-
arg2 = "value2"
142-
}
143-
]
139+
cmdline = [
140+
{
141+
foo = "1"
142+
bar = "bye"
143+
},
144+
{
145+
foo = "2"
146+
}
147+
]
144148
}
145149
```
146-
The kernel supports passing the same option multiple times. If you need this, use separate cmdline blocks.
147-
148-
```hcl
149-
resource "libvirt_domain" "my_machine" {
150-
//...
151-
152-
cmdline {
153-
arg1 = "value1"
154-
}
155-
cmdline {
156-
arg1 = "value2"
157-
}
158-
}
159-
```
160-
161-
~> **Note well:** `kernel` and `initrd` have to be specified at the same time; `cmdline`
162-
arguments can be specified only when `kernel` and `initrd` have been defined.
163-
Otherwise libvirt will refuse to start the domain.
164-
165150
### UEFI images
166151

167152
Some extra arguments are also provided for using UEFI images:

0 commit comments

Comments
 (0)