Skip to main content
Share Your Experience: Take the 2024 Developer Survey
25 votes
Accepted

How to use cloud-init with Terraform?

Cloud-init files are essentially bootstrap codes, that run before each startup, and can - among others - modify files, set up services, create users, etc. Not all types of droplets support all ...
SztupY's user avatar
  • 1,577
6 votes

How to use cloud-init with Terraform?

When you create an Auto Scaling group with Terraform, you can specify the user_data to be used by instances created by this ASG. Documented here - https://www.terraform.io/docs/providers/aws/r/...
Evgeny Zislis's user avatar
3 votes

Cloud-Init Script Won't Run?

There are a few issues with this cloud-init script. #groups is commented out, so the list beneath it makes it invalid YAML. Even if we uncomment groups, - ubuntu: [root,sys] is invalid because the ...
falcojr's user avatar
  • 141
3 votes
Accepted

How come my hostname isn't set to the FQDN with cloud-init when using `prefer_fqdn_over_hostname`?

This is a bug in cloud-init, I've filed it upstream as Bug #1966533 I was getting silent failures because the hostname was host-10-2-65-89.openstack.build. Instead of host-10-2-65-89.openstack.build ...
Evan Carroll's user avatar
  • 2,161
2 votes

How to provide multiple configs for EC2 node using Terraform and cloud-init?

It sounds like you want to do some configuration management upstream from the terraform. I would suggest following a pattern of writing Packer templates to build and provision the AMIs before running ...
Bruce Becker's user avatar
  • 3,603
1 vote
Accepted

Does cloud-init store the copy of the init it ran first?

It seems to be stored under /var/lib/cloud/instances Under your instance id. cd /var/lib/cloud/instances/$(cloud-init query instance_id) For me I found the information I wanted in user-data.txt. ...
Evan Carroll's user avatar
  • 2,161
1 vote

Using a terraform template to produce a cloud-init yaml: template variables do not respect yaml context/whitespace

By the way if you want to use yaml for your cloud-init template you can achieve what you want using indent function ssh_keys: rsa_private: | ${indent(4, "${private_key}")} Make sure ...
Trayan Azarov's user avatar
1 vote

What do you call variables like "%(ec2_region)" in my cloud-init?

This is called instance metadata. Cloud providers expose metadata to cloud instances which cloud-init then stores and can be used in a few different contexts, such as jinja-templated cloud-init ...
falcojr's user avatar
  • 141
1 vote
Accepted

Provision and configure Azure VM in private subnet (file, remote-exec, cloud-init, etc.)

Hashicorp recommends using provisioners only as a last resort. They recommend using the Azure VM custom_data method, or cloud-init where available. Ansible would likely be overkill unless you will ...
T.H.'s user avatar
  • 136
1 vote

How to combine cloud-init with Azure ARM Template

I feel like you are providing the answer yourself. Encode the entire cloud-init file as one-line base64 using a pre-processing script. Something like cat cloud-init.txt | base64 -w0 would work for ...
Michael's user avatar
  • 11
1 vote

How do I install Terraform libvrit_cloudinit?

Try to use libvirt_cloudinit_disk instead of libvirt_cloudinit. I think it is deprecated.
Can's user avatar
  • 29

Only top scored, non community-wiki answers of a minimum length are eligible