Comments (3)
Hi @baverman
Can you confirm disk are already present in your template ?
I think this is beacuse your disk is already in the template. As it is not explicitly declare in the VM when you apply a second time, the provider consider the VM has no disk and it detach all disks.
If this is the case, it means there is also the same issue with NIC.
For readability and maintenability it is better to have disk explicitely declare in the VM instead of template. However the current behavior is a bug and the provider must be fixed to not remove elements (disks, nic) from a VM in that case.
from terraform-provider-opennebula.
Can you confirm disk are already present in your template ?
Yes. Template is defined with a disk.
For readability and maintenability it is better to have disk explicitely declare in the VM instead of template.
I will be glad to use disk image but our current setup assumes some context boot hda device and I did not managed to create a working VM without a template.
from terraform-provider-opennebula.
Thank you for reporting this,
This is not a behavior specific to disks and NICs, unexpected things could happen later for other VM parts (OS, graphics etc...) added via the template only and with an update behavior.
You're in the only case that trigger the problem:
At VM creation, with a template_id
, the parts described in the tf file will overwrite template parts. (putting disk in tf file will overwrite disk descriptions from the template. The only part that has a custom behavior is the context part).
This problem is triggered by the diff that terraform see on disk attribute.
In the VM schema, disk type is TypeList
, but when reading VM description there is no distinction made between a disk added via the template, and those added via the tf file.
To avoid this diff my first idea was to try to customize the diff via CustomizeDiffFunc
, however terraform diff tooling doesn't seems to be enough accurate to remove partial diff.
This seems too complex/inaccurate to implement for now. (As a side note, we aren't up to date in this provider, we don't use the last terraform SDK versions)
Another way to do, is to modify the VM schema and read step to differentiate how we process the disk added via the template, and the disk added via the TF file.
Here is my draft PR, I made some manual tests and it seems to work, feel free to test it and drop comments about it: #100
In brief, disk and NIC added via the template are added in a separated list filled at VM creation.
However it's not possible anymore to detach them later.
It's important to note that this last solution add a bit more of complexity to the VM resource implementation around disk and NIC, which is already complex.
The whole complexity is due to the fact that they are list of schemas and it's not so easy to work with.
So, an other solution that I have to mention (already mentioned here) is:
Instead of having a complex VM resource with all stuffs included and with complex update behaviors, we could introduce opennebula_virtual_machine_nic
and opennebula_virtual_machine_disk
resources.
This would split VM schema and related code among several resources which would be more simple.
Disks and NIC provided via the template could be immutable, in the same way that I considered above so I'm not sure that we would loose something with this last approach.
Here is an old draft branch that externalize NIC ressource attachment
The problem is that this would break a bit the current provider architecture
from terraform-provider-opennebula.
Related Issues (20)
- Issue with Services: Unable to Create Reserve from Network HOT 6
- Security group management leads to detach and attach of the NIC HOT 3
- How to set the owner of a virtual network? HOT 3
- ```cpumodel``` Crash report HOT 1
- virtual machine (ID: 14): unexpected state 'POWEROFF', wanted target 'RUNNING'. last error: %!s(<nil>) HOT 2
- Impossible to update context of Virtual Router instances
- Add memory, CPU and disk costs in the template resource HOT 2
- It is not possible to add more than a PCI device (passthrough) to a VM HOT 1
- Error creating Ceph Datastore: "SYSTEM datastores cannot have DS_MAD defined"
- Trailing space in `CEPH_HOST` when creating a Ceph datastore
- Missing Data Source for opennebula_virtual_network_address_range
- `opennebula_service` does not honor idempotence (OneKE) HOT 2
- `opennebula_virtual_router_nic`: Add floating_only argument
- Extend `nic` section, add missing arguments like METHOD, GATEWAY or DNS..
- When attempting to create a Ceph datastore of type "IMAGE", the following error occurs: HOT 4
- `opennebula_service` should support role scale operation HOT 1
- VNet address reservation on VNet (inside cluster) looses cluster_ids information on subsequent terraform apply runs HOT 1
- Terraform loses disk in state after resize HOT 2
- Extend "os" section, adding other OS sub-attributes in opennebula_template HOT 1
- Manually Deleted VMs are not recreated HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-opennebula.