You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56Lines changed: 56 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -303,6 +303,62 @@ See the [examples](./examples) directory for more usage examples.
303
303
304
304
## Migration from Legacy Provider (v0.8.x)
305
305
306
+
### Getting Domain IP Addresses
307
+
308
+
The legacy provider exposed IP addresses directly on the domain resource via `network_interface.*.addresses`. The new provider uses a separate data source for querying IP addresses:
309
+
310
+
**Legacy provider (v0.8.x):**
311
+
```hcl
312
+
resource "libvirt_domain" "example" {
313
+
# ... domain config ...
314
+
}
315
+
316
+
output "ip" {
317
+
value = libvirt_domain.example.network_interface[0].addresses[0]
318
+
}
319
+
```
320
+
321
+
**New provider (v0.9+):**
322
+
```hcl
323
+
resource "libvirt_domain" "example" {
324
+
# ... domain config ...
325
+
}
326
+
327
+
data "libvirt_domain_interface_addresses" "example" {
328
+
domain = libvirt_domain.example.id
329
+
source = "lease" # or "agent" or "any"
330
+
}
331
+
332
+
output "ip" {
333
+
value = data.libvirt_domain_interface_addresses.example.interfaces[0].addrs[0].addr
334
+
}
335
+
```
336
+
337
+
Alternatively, use the `wait_for_ip` property on the domain's interface configuration to ensure the domain has an IP before creation completes:
338
+
339
+
```hcl
340
+
resource "libvirt_domain" "example" {
341
+
name = "example-vm"
342
+
memory = 512
343
+
vcpu = 1
344
+
345
+
devices = {
346
+
interfaces = [
347
+
{
348
+
type = "network"
349
+
source = {
350
+
network = "default"
351
+
}
352
+
wait_for_ip = {
353
+
timeout = 300 # seconds
354
+
source = "lease"
355
+
}
356
+
}
357
+
]
358
+
}
359
+
}
360
+
```
361
+
306
362
### Volume Source URLs
307
363
308
364
If you're migrating from the legacy provider and used the `source` attribute on volumes to download cloud images, note that this feature is now available via the `create.content.url` block:
0 commit comments