Closed dasleben closed 1 year ago
A bit more of context:
features
section was introduced by #237 (release 0.5.0 so features
wasn't here at the VM creation ... ? ) for the template
resource only, however some reading code parts are mutualized with the VM code.
There wasn't any problem because the shared reading code was protected by a condition that prevented features
to be read from the VM code: if the features
section wasn't described in the configuration, then reading code wasn't executed.
Infortunately, the shared code part that read features
has been modified by #378 (release v1.1.1) to improve the import of virtual machines. #378 made reading conditional for sections inherited from a template (based on the content of template_section_names
).
The problem is that you created the VM with an old release that didn't filled template_section_names
(didn't exists yet), so the provider isn't able to know that features
is inherited from a template.
It's why with the 1.2.0 release: the virtual machine is trying to read the features
section and fails because it hasn't any features
section in it's schema...
I'll make some tests to confirm I'm right then I'll submit a PR
I reproduced the problem but I created the VM with the 0.5.0 release (from which features
has been introduced).
It's only a migration problem: when I create the VM with the 1.2.0 release I don't reproduce the issue.
PR #427 fix the problem.
An other way to fix this without any PR is to edit the state and add:
"template_section_names": {
"FEATURES": "",
},
I reproduced the problem but I created the VM with the 0.5.0 release (from which
features
has been introduced). It's only a migration problem: when I create the VM with the 1.2.0 release I don't reproduce the issue.Yes, you are right, there are no errors when updating a VM created with version 0.5+. PR #427 fix the problem.
An other way to fix this without any PR is to edit the state and add:
"template_section_names": { "FEATURES": "", },
I'm trying to add to
resource "opennebula_virtual_machine" "vm"
section
template_section { name = "template_section_names" elements = { FEATURES="" } }
But it doesn't work. Tell me if I'm doing the right thing or not?
You don't had it to the right file, this should be added in the VM state in the terraform.tfstate file.
Community Note
Terraform Version
Terraform v0.13.7
Affected Resource(s)
opennebula_virtual_machine
Panic Output
Expected Behavior
Actual Behavior
Steps to Reproduce
Attribute is defined in template on cloud side.
A VM was created with version provider 0.4.2. After update for version 1.2.0 command
terraform plan
end with error. With version 1.1.0 this error is not observed