vatesfr / terraform-provider-xenorchestra

Xen Orchestra provider for Terraform
MIT License
150 stars 33 forks source link

Cloud Config Verification or object format #202

Closed deefdragon closed 1 year ago

deefdragon commented 2 years ago

I spent far longer than I should have attempting to get cloud config working (in large part because of the required comment) and most of the times that I failed were because of improper cloud config. Given the difficulty of debugging cloud-config at times, would it be possible to throw an error if the yaml is invalid (or missing that starting comment etc.) and or, would it be possible to have an object input instead of a string input that automatically adds the comment and formats the object to yaml in-code?

4censord commented 2 years ago

It may be worth looking into https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/cloudinit_config

ddelnano commented 2 years ago

Apologies for the late reply, I think it would be best to rely on an official cloudinit config generator like @4censord mentioned. I am open to adding a light amount of validation to prevent obvious errors, but anything beyond that should use a more official mechanism.

When writing cloud config I rely heavily on the documentation (I do it very infrequently), so if there are other things you think should be considered outside of what you mentioned please say so.

ddelnano commented 1 year ago

I've added a warning log when the #cloud-config string is missing in the template in #219. The XO client doesn't have a yaml parser installed and so I felt that was not worth the additional dependency for now.

ddelnano commented 1 year ago

224 should be a more improved version of my first attempt.