You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is how you tell compute-instance module to inject a file using user_data module argument:
# declare a Variable Input to be used as a module argument and assign it a valuevariable"some_user_data_variable" {
description="provide a shell script or Cloud-Init configuration file to be passed to a compute instance to be executed at instance's first boot"type=stringdefault="path/to/your/file"
}
# declare your module using the variable you just createdmodule"a_compute_instance" {
source="oracle-terraform-modules/compute-instance/oci"version="2.3.0"...// insert all required argumentsuser_data=filebase64(var.some_user_data_variable) // add `user_data` argument
}
You can have a look at https://github.com/kral2/iacbox to see how it can be used in a real Terraform configuration. Pay attention particularly to these lines:
The file type will be automatically detected and then executed by Cloud-Init, whether it is a shell script or a cloud-init configuration. No additional configuration needed.
I will probably update #74 to include examples in the module's repo. In the meantime, this issue should provide the necessary guidance to use the existing feature.
Please feel free to additional feedback if you think you are still missing something to use this feature 👍
can you provide an example cloud-init-file and shell script and how to use it in user_data?
I have created an example repo: https://github.com/has12zen/terraform-oci-compute-instance
please can you help me.
The text was updated successfully, but these errors were encountered: