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
{{ message }}
Repository navigation
Change port mac will cause instance destroy and recreate #1942
If I change the mac from fa:16:3e:c8:0c:03 to fa:16:3e:c8:0c:04,the terraform destroy plan will show port must replace and cascade cause instance destroy and recreate.
As openstack api describe, change mac_address not cause port destroyed,so maybe it's not necessary to destroy port but update port mac_address instead.
@kayrus I never developed for a terraform provider, so I have a question...
Apparently, we can't change the MAC address while a port is attached to a server (which seems ok). But, by design, I believe it won't make sense to dettach from a server and attach it again after the update. Still, do we want to support the ability to update mac addresses for ports?
but got 409 instead: {"NeutronError": {"type": "PortBound", "message": "Unable to complete operation on port 4988c401-c52c-4c99-af2b-830cc0d0e517, port is already bound, port type: ovs, old_mac fa:16:3e:c8:0c:04, new_mac fa:16:3e:c8:0c:05.", "detail": ""}}
well, you can add support for the port MAC address update, but in port resource docs you should mention that the port must be detached before the mac update.
from the other hand, it's more straightforward to keep this as is, when terraform automatically resolves the dependencies and detaches the port before update the MAC.
well, you can add support for the port MAC address update, but in port resource docs you should mention that the port must be detached before the mac update.
That is a option, but I think it's weird the user detach the port manually and after that run the terraform, or run one apply to remove port and update it and run another one to attach it again.
do you have other thoughts?
I was taking a look how other providers do, and I found this for the AWS provider. It has a interface_attachment resource that manages attachment and terraform controls the dependency between server <-> port
That is a option, but I think it's weird the user detach the port manually and after that run the terraform, or run one apply to remove port and update it and run another one to attach it again.
Activity
kayrus commentedon Aug 1, 2025
@suddenDisappear thanks for the bug report. could you please provide more details? TF snippets, API debug logs?
suddenDisappear commentedon Aug 27, 2025
My tf demo is like below:
If I change the mac from
fa:16:3e:c8:0c:03tofa:16:3e:c8:0c:04,the terraform destroy plan will show portmust replaceand cascade cause instance destroy and recreate.As openstack api describe, change mac_address not cause port destroyed,so maybe it's not necessary to destroy port but update port mac_address instead.
kayrus commentedon Aug 28, 2025
@suddenDisappear thanks for the details. MAC address update must be implemented in gophercloud first. Can you proceed with this?
winiciusallan commentedon Jan 6, 2026
hey @kayrus, can we bump gophercloud's version to 2.10.0 so we can have the necessary change for updating MAC addresses?
kayrus commentedon Jan 7, 2026
sure. just submit a PR
winiciusallan commentedon Jan 7, 2026
Here it is #2004.
winiciusallan commentedon Jan 12, 2026
@kayrus I never developed for a terraform provider, so I have a question...
Apparently, we can't change the MAC address while a port is attached to a server (which seems ok). But, by design, I believe it won't make sense to dettach from a server and attach it again after the update. Still, do we want to support the ability to update mac addresses for ports?
kayrus commentedon Jan 15, 2026
well, you can add support for the port MAC address update, but in port resource docs you should mention that the port must be detached before the mac update.
from the other hand, it's more straightforward to keep this as is, when terraform automatically resolves the dependencies and detaches the port before update the MAC.
do you have other thoughts?
winiciusallan commentedon Jan 16, 2026
That is a option, but I think it's weird the user detach the port manually and after that run the terraform, or run one apply to remove port and update it and run another one to attach it again.
I was taking a look how other providers do, and I found this for the AWS provider. It has a
interface_attachmentresource that manages attachment and terraform controls the dependency between server <-> porthttps://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance#network-interfaces
Maybe add a new resource just to manage this kind of use case is like using a sledgehammer to crack a nut. What do you think?
kayrus commentedon Jan 22, 2026
actually this should happen automatically in one run, same way AWS provider does this, see https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs/resources/compute_interface_attach_v2#attachment-using-an-existing-port