terraform-provider-libvirt
terraform-provider-libvirt copied to clipboard
MAC unbinding is not happening when terraform destroy is performed
network_interface { network_name = "default" wait_for_lease = "true" }
when we use wait_for_lease mac-binding works (able to see the mac entry) .But mac-binding entry is not getting removed when terraform destroy is performed
<network>
<name>default</name>
<uuid>376edc07-e4aa-4cb5-a752-a95f5af87c38</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='br0' stp='on' delay='0'/>
<mac address='48:df:37:89:e8:55'/>
<dns enable='no'/>
<ip family='ipv4' address='10.184.232.38' prefix='23'>
<dhcp>
<range start='10.184.232.39' end='10.184.232.52'/>
<host mac='52:54:00:42:A7:7D' name='libvirt-Lukjvf' ip='10.184.232.51'/>
.232.50'/>
</dhcp>
</ip>
<route address='10.184.232.0' prefix='23' gateway='10.184.232.1'/>
</network>
localhost:~ # virsh version
Compiled against library: libvirt 6.0.0
Using library: libvirt 6.0.0
Using API: QEMU 6.0.0
Running hypervisor: QEMU 4.2.0**
Terraform v0.12.24
@MalloZup / @dmacvicar any updates on the issue
I have the same problem.
I can trace this behavior of adding the MAC entry to f6a85
I don't really know why we are adding the MAC to the network host list. If a network card specifies DHCP, it has nothing to do with the network configuration, which should be done in the network resource.
The current network resource tries to do lot of magic, and I'd prefer to focus efforts in finishing network_v2 which follows a schema/behavior closer to libvirt.
That said, I will gladly accept patches. I'd guess a function similar to addOrUpdateHosts
in the domain destroy hook should do it.