-
Notifications
You must be signed in to change notification settings - Fork 52
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
F-72: Allow update of VM NICs and update disks for consistency #80
Conversation
51cc0e2
to
b63e76f
Compare
c7a3a5e
to
5f56437
Compare
Here is what's happening on this PR: new acceptance tests don't pass due to the fact that NIC schema fields are marked as This is ok, but this lead to an unexpected behaviour: in case of a NIC update (tf file is modified to detach and attach a single NIC) the diff is broken.
Here, the There is a lot of issues around, this one has some clear explanations: hashicorp/terraform-plugin-sdk#282 Some ways I explore to try to fix this:
This also concern a previous PR already merged about disks #64 |
I see two ways to solve the problem based on 2. and 3. from comment above. The 2. could be a temporary solution until hashicorp/terraform-plugin-sdk#282 is solved (the problems seems to be that they want to keep backward compatibility with old terraform versions). The 3. which introduce a new resource that manage NIC attachement would lead to a new way to describe resource dependencies that solve the problem stated above, but would also partly split NIC (same would apply for disk) management from VM resource. Here is the POC branch with new resource and tests: https://github.com/treywelsh/terraform-provider-opennebula/tree/F-72-new-ressource-nic |
1849313
to
5368051
Compare
Implement 2. There is a bit more to improve overall behavior and for consistency:
|
- split disk computed attribute - remove useless state check from disk update - compare disk list based on configs
This PR allow to update the NICs of a VM in a RUNNING/POWEROFF state.
But overall, the behaviour is the same that for disk update in #59
This PR remove some computed attributes around that were not useful.
I updated helpers that make diffs on list of configs (NIC, disk...)
One change that doesn't impact much the code is that a VM doesn't have transitional states when attach/detach a NIC from a VM in POWEROFF state.
To make less requests we could remove the waitForVMState call in this case.