-
Notifications
You must be signed in to change notification settings - Fork 684
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
Multiple security_list_ids in baremetal_core_subnet Cause Subnet Resource to Add/Detroy Every Time #44
Comments
Example snippet: resource "baremetal_core_subnet" "baston-subnet" { |
One other note, we are currently on Terraform v0.8.8, not sure if we should be on a newer version. |
hi
AFAIK, terraform v.0.9 is not yet supported.
- Sriram
… On Mar 28, 2017, at 4:12 PM, beamanm ***@***.***> wrote:
One other note, we are currently on Terraform v0.8.8, not sure if we should be on a newer version.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#44 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAt8Jd32rZ7YFaAlsGXNgpl_uCSso2FFks5rqZP1gaJpZM4Mqg0j>.
|
Just FYI, I've reproduced this issue. @craigcarl-oracle there is no facility immediately apparent to me in terraform to handle list ordering issues like this. I think ideally the security_list_ids attribute is always ordered consistently in API responses (both from creation (POST) and fetching (GET). There is a diff suppression function, but it receives each key individually, e.g. |
@mikejihbe It's a fairly serious issue, it can lead to data loss when an instance gets terminated unexpectedly. We're going to need a fix in the provider even if it's temporary and hacky. I'm still not completely clear on what dimension TF needs the list of SLs ordered in, is it creation date? Ascending or descending? I think there are two different situations we're going to need to deal with -
I don't think your proposed fix will deal with the second situation, if we always suppress the diff wouldn't that prevent changes to the SLs attached to a subnets? Can we can get the order SLs were created in from the state and use that to order the list of SLs appropriately? I'll file a ticket against the API once we've determined exactly what needs to change. |
It doesn't matter what the order is as long as it's consistent. You're right, this change will not cause adding or removing security lists to not destroy and re-create the subnet. That is an API limitation though, there is no security_list_ids parameter in the update api |
@mikejihbe We're not supporting the addition/removal of SLs yet, ignore that case. Can we internally add
to every |
It looks like the lifecycle attributes are only presented in the parsing, so there are actually no schema attributes we could update to influence the lifecycle in this fashion. I tried for a few hours to get DiffSuppressFunc to do what we want, but it's not working. I also looked for but couldn't find an example of a list being "internally" suppressed like we want here. |
I had another thought here. The problem may not be unstable sorting on the API, the problem may be that stable sorting from the API is different than the order presented in the TF statefile by the user. We could probably mitigate this problem by altering our GET function to order the subnet ids in the same order as what exists in the tf state (if any) if possible. |
`baremetal_core_subnet.security_list_ids` with multiple items causes destroy/add on every `terraform apply`, even with no changes. API state does not respect item ordering, so config and API state do not match (except when items happen to have exactly the same sorting as used by API state). Because local and remote state do not match, terraform will attempt to change remote state to match on every `apply`. Change `security_list_ids` from `TypeList` to `TypeSet`, so terraform only considers membership, not ordering. Fixes oracle#44
Multiple security_list_ids in baremetal_core_subnet Cause Subnet Resource to Add/Detroy Every Time, even with no changes. If I reorder the security_list_ids to what terraform is expecting (ie swap the pair) this seems to resolve the issue. There doesn't seem to be a pattern, but for longer seclists (2+), they pretty much guarantees the subnets/compute instances will rebuild on every apply. Also, what is the seclist number limit for resources?
The text was updated successfully, but these errors were encountered: