Skip to content
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

make cloudinit content easier to pass to instance #74

Open
2 tasks
kral2 opened this issue Sep 27, 2021 · 1 comment
Open
2 tasks

make cloudinit content easier to pass to instance #74

kral2 opened this issue Sep 27, 2021 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@kral2
Copy link
Contributor

kral2 commented Sep 27, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Currently, cloud-init script content can be passed to an instance using var.user_data. This is in line with the provider argument, but it is not really explicit from a user perspective. Also, the content of user_data needs to be provided in the correct format: a base64-encoded string.

The proposition is to use var.cloud_init_file to provide the content of user_data to oci_core_instance. This would effectively deprecate var.user_data from the module.

Cloud-init files being mostly multi-line, it is probably more easy to restrict the input to be a file, rather than allow for any arbitrary string. Multi-line strings are possible using HEREDOC strings, but it would only add complexity without real benefits for the user.

New or Affected Resource(s)

oci_core_instance

Potential Terraform Configuration

metadata = {
...
user_data = var.cloud_init_file != "disabled" ? "${filebase64(var.cloud_init_file)}" : null
...
}
  • implement the new feature
  • add examples

References

Terraform Filebase64 Function

@kral2 kral2 added the enhancement New feature or request label Sep 27, 2021
@kral2 kral2 added this to the Future milestone Oct 6, 2021
@vadyochik
Copy link

i do really think the proposition is useless and current implementation is totally fine..

what';s wrong with the example you provided in that issue #86 ??

user_data = filebase64(var.some_user_data_variable)

and what do you propose instead of this:

  user_data = base64encode(
    templatefile(
      "${path.module}/cloud-init.sh.tftpl",
      {
        image            = var.image,
        args             = var.image_args,
        vpn_vendor       = var.vpn_vendor,
        vpn_username     = var.vpn_username,
        vpn_password     = var.vpn_password,
      }
    )
  )

??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants