-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provider/openstack: Resolve issues with Port Fixed IPs #13056
Conversation
Also, it seems #12613 broke some acceptance tests in a few other Network resource tests. No crashes, but just invalid references to resource attribute names. This PR resolves those issues. I've run the entire suite of |
…urce This commit adds the `all_fixed_ips` attribute to the openstack_networking_port_v2 resource. This contains all of the port's Fixed IPs returned by the Networking v2 API.
This commit reverts the changes made in a8c4e81. This re-enables the ability to reference IP addresses using the numerical-element notation. This commit also makes fixed_ip a non-computed field, meaning Terraform will no longer set fixed_ip with what was returned by the API. This resolves the original issue about ordering. The last use-case is for fixed_ips that received an IP address via DHCP. Because fixed_ip is no longer computed, the DHCP IP will not be set. The workaround for this use-case is to use the new all_fixed_ips attribute. In effect, users should use fixed_ip only as a way of inputting data into Terraform and use all_fixed_ips as the output returned by the API. If use-cases exist where fixed_ip can be used as an output, that's a bonus feature.
64f4d65
to
3d60e11
Compare
I've just tested a configuration state with the current The end result is that Detected changes to the I've given this PR a lot of thought and I'm still convinced it's the right way to go. Having Upon report that Fixed IPs were being re-ordered in the state, changing to Therefore, making |
LGTM - the reasoning seems sane |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This commit has two parts:
It adds a new computed-only attribute called
all_fixed_ips
which contain all of the fixed IPs returned by the OpenStack Networking API in the order the API sent them.It changes the
fixed_ip
attribute back to a TypeList, reverting the change made in provider/openstack: Change Port fixed_ip to a Set #12613. The change made in provider/openstack: Change Port fixed_ip to a Set #12613 resolved the reported issue, but created other state issues in different use-cases.Fixes #13052
Supersedes #12807
@stack72 Let me know if you would like to discuss this one in more detail.
I'm pretty sure moving from
TypeSet
toTypeList
is safe to do, but maybe I am wrong about that.The main change being made (making
fixed_ip
non-compute) will affect users who were relying on referencing a DHCP-allocated IP byopenstack_networking_port_v2.foo.fixed_ip.0.ip_address
. They will now need to useopenstack_networking_port_v2.foo.all_fixed_ips.0
. This should probably be noted in the CHANGELOG.Users who specified a static IP can return to referencing
openstack_networking_port_v2.foo.fixed_ip.0.ip_address
as they did before, since it's not relying on a returned API value. The most notable reason for doing this is to make implicit ordering between resources.Users who reported issues with
fixed_ip
being re-ordered upon arefresh
are still in the clear sincefixed_ip
is no longer being set by Terraform.Unless I'm mistaken, with the list of scenarios in #13052, there are just too many varied cases that can be cleanly applied in
fixed_ip
alone. Notably, creating a unique hash withTypeSet
is not possible when a user wants multiple DHCP-based Fixed IPs since the only required piece of data is asubnet_id
, and if there are multiple entries with the samesubnet_id
, Terraform will hash them all the same and aggregate them into 1 requested IP. Further, ifip_address
is also used in the hash, then DHCP IPs will have a new generated hash afterapply
finishes. Therefore, something likeall_fixed_ips
is needed.Perhaps a better long-term design is to create a dedicated
openstack_networking_port_fixedip_v2
resource and deprecate the use offixed_ip
andall_fixed_ips
, but, again, the multiple-DHCP use-case is probably going to make that difficult./cc @sebastien-prudhomme