-
Notifications
You must be signed in to change notification settings - Fork 16
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
Allow executing commands following creation in incus_instance
#86
Comments
For reference, here is the Terraform documentation on provisioners: https://developer.hashicorp.com/terraform/language/resources/provisioners/syntax Note the emphasis on this being a last resort type thing and cloud-init or similar cloud meta-data being recommended over the use of provisioners. I'm also struggling to find any good documentation on having a terraform provider expose additional provisioners. Do you have any link to another Terraform provider offering this? |
Hello Stéphane! Terraform and Open-tofu have 3 provisioners and they are well documented:
However, lxd and incus have built-in mechanism to run any command in container directly without using and/or configuring any external tools and this mechanism can be used for incus provisioner I've prepared working example how to use local-exec provisioners with incus provider.
Code will be more clean and stable If local-exec provisioner can be replace with incus-exec provisioner. |
@tregubovav-dev do you have any pointers on how to implement a custom provisioner? All I can find from hashicorp is documentation why this is a bad idea and telling you that there's a fixed set of built-in provisioners. If it's possible to define an actual additional provisioner, then I'm not too opposed to it. What I'm opposed to is having Resources abused for this kind of thing, so I don't want to see an For that matter, I think we should remove:
@maveonair @adamcstephens @mdavidsen what do you all think? |
Here are links to:
Here is one of the discussions about 'docker-exec' provisioner: hashicorp/terraform#4686 If you decide removing P.S. |
I had short discussion with Terraform team in the thread and get very clear clarification about provisioners support by Terraform.
|
Yeah, a post-create exec thing within the instance resource should be more reasonable and similar to the file option that's already supported there. |
incus_instance
The LXD provider is still under the MPL so we can import code from it just fine, we'll just want to make sure we're happy with the way it's done. |
I have migrated my cluster from LXD to Incus recently. However, I will try to deploy single VM for LXD and will try whether lxd provider's I did small experiment and I can say:
|
This is follow up to the closed issue #27.
Preamble
Incus provider for terraform/open-tofu does not allow to deploy and provision any packages in the deployed container without 3'rd party tools. This impacts on deployment stability and possible compatibility issues with these 3rd party tools.
Problem
Infrastructure requires to deploy Linux container(s), and install and configure specific services on them. As incus provider does not provide functionality to install packages and/or run shell command in the container, we should use other solutions provided by incus and or terraform/open-tofu.
cloud-init
terraform/open-tofu local provisioner
using ansible provider
Proposed solution
To implement provisioner incus-exec which can run any command directly in the incus container or VM. Provisioner incus-exec section can be added to most of resources, for example to incus_instance, incus_file, incus_storage_volume, terraform_data, etc. This provisioner can use the same schema as local-exec provisioner.
The text was updated successfully, but these errors were encountered: