-
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: Ignore order of security_groups in instance #3651
Conversation
8098007
to
59828de
Compare
@phinze This is the same solution that was suggested in #2284. Unfortunately it was rolled back due to concerns about schema migrations. I left a question in #2284 about whether a schema migration is really needed as I was unable to break anything by launching resources, switching to the patched version, then resuming work. Thoughts? |
@jtopjian Ah yes, the reason nothing broke is because - as the state representation is currently implemented - a TypeSet can be successfully parsed out of the state for an attribute that was stored in the TypeList format. It's a bit of a cheat semantically speaking, but I think we should be able to use it successfully. |
To be clear: after the first run with the newer version of Terraform - the state version will be stored in the standard TypeSet format. You saw this in your testing as well as the monotonically increasing integers switched to hashcodes. |
@phinze So this should be OK to merge without a schema migration? With the understanding that this was, more or less, a lucky break? |
Yep - sounds about right. Merge away! ( See #3696 (comment) for my merge+changelog crash course. 👌 ) |
okie dokie. acceptance tests pass. |
provider/openstack: Ignore order of security_groups in instance
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. |
Problems
When execute
terraform plan
afterterraform apply
with same template by provider/openstack, sometimes output some changes of securitygroups.This problem is occurred when created securitygroups have mismatched between order of ID and order of
security_groups
attribute in template like below.If assigned ID of
sg1
larger than ID ofsg2
,terraform plan
will output following changes.I think this problem is relevant to openstack API response to get server information.
Following request return security_groups that is sorted by ascending order on ID. In addition, these response hasn't ID attribute.
Fix
Order of SecurityGroups can be ignored. I changed security group from
TypeList
toTypeSet
.