I’m using Terraform to spin up a DO droplet, using an Ubuntu and Docker image. Checkout below:
resource "digitalocean_droplet" "web" {
image = "docker-20-04"
name = "web"
region = "nyc3"
size = "s-1vcpu-1gb"
ssh_keys = [digitalocean_ssh_key.default.id]
user_data = "I2Nsb3Vk #.....etc......"
}
user_data is my cloud-config template encoded in base64.
I ssh into the droplet and notice that the packages listed in the template below are not getting installed.
#cloud-config
package_upgrade: true
package_update: true
packages:
- build-essential
- libmariadbclient-dev
- libjpeg62-turbo-dev
- zlib1g-dev
- libwebp-dev
- libpq-dev
- postgresql
- postgresql-contrib
Is there something wrong with my cloud config file above?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
Ensure your cloud-config file has the correct format and proper YAML syntax. Your current file looks correctly formatted, but you can check it using a YAML linter like YAMLlint to be certain.
If the syntax is correct, verify that the user_data is properly encoded in base64. Remember, the entire cloud-config file should be encoded before being placed in user_data.
If you continue to have issues, check the logs for any errors by running this command on your droplet:
- cat /var/log/cloud-init-output.log
For further information about cloud-config with DigitalOcean, refer to this Automate Droplet Setup with cloud-init.
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.