-
Notifications
You must be signed in to change notification settings - Fork 53
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
opennebula_service_template
: Improve idempotence
#468
Comments
To clarify -> if you add the missing |
Hi, Thanks for reporting this, I'll try to give a lot of informations as a starting point to work on this problem, feel free to discuss if you have some better ideas or if I made a mistake somewhere :) A bit of context: Some more details on what's happening in the create and read step of the provider for the I'm able to reproduce the problem of this issue applying this:
The diffs appears at the next plan. In the provider the content of the Then the service is created from this structure: As a side note, I don't get why this code is here: https://github.com/OpenNebula/one/blob/master/src/oca/go/src/goca/service_template.go#L117 Now let's look at the Goca Create method for the service template resource: It's splitted across Goca and the provider but the json content is unmarshalled, then marshalled and again unmarshalled. Here the log I got:
Now we need let's look at the reading step so I added a logging line here in the provider https://github.com/OpenNebula/terraform-provider-opennebula/blob/master/opennebula/resource_opennebula_service_template.go#L265 Again it the code there's some marhal/unmarshaling.
All the diffs shown by terraform seems to be on absent fields, or fields with their "empty" value (0 for an integer etc.) Not sure on how we should fix this, some quick ideas to test:
But if possible, from terraform point of view it may be better to do some refactoring (in the provider and probably in Goca) to work with Would this last solution be possible ? (I'm asking because in https://marketplace.opennebula.io/appliance/7c82d610-73f1-47d1-a85a-d799e00c631e I already see the json to pass in |
Description
terraform apply
twice causes:Terraform and Provider version
Affected resources and data sources
opennebula_service_template
Terraform configuration
Expected behavior
The second
terraform apply
run should be idempotent and the resource should not be recreated (it should be at least in-place modified).Actual behavior
The second
terraform apply
run recreates the resource despite there is no actual difference in the config.Steps to Reproduce
Debug output
N/A
Panic output
N/A
Important factoids
https://pls.watch/#v=https://i.imgur.com/LXzo2h8.mp4&t=5s;8s 🤔
References
https://docs.opennebula.io/6.6/integration_and_development/system_interfaces/appflow_api.html#service-schema
The text was updated successfully, but these errors were encountered: