dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.54k stars 457 forks source link

MAC address attribute #841

Open stacab opened 3 years ago

stacab commented 3 years ago

Hello, AFAICS, only getting IP address of guest is supported (via network_interface.<N>.addresses.<M>) Would be possible to add also reading of MAC address as attribute of libvirt_domain?

vrga commented 3 years ago

I've personally taken to just getting mac addresses and IP's like this:

output "workers_ips" {
  value = {
    for worker in libvirt_domain.worker :
    (worker.name) => {
      mac       = distinct(flatten(concat([for interface in worker.network_interface : interface.mac])))
      addresses = distinct(flatten(concat([for interface in worker.network_interface : interface.addresses])))
    }
  }
}