Questions tagged [cloud-init]

20 questions
29
votes
2 answers

How to use cloud-init with Terraform?

I am working with Digital Ocean and Terraform and I already can automate the domain, subdomain, network preferences and the host but there is a section called User data that looks like this: The description of that field says Allows the use of…
Gepser Hoil
  • 1,312
  • 1
  • 15
  • 19
4
votes
1 answer

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

I need to use several configs on my EC2 node using Terraform. data "template_cloudinit_config" "puppetserver_config" { gzip = true base64_encode = true part { filename = "initial.sh" content_type =…
4
votes
2 answers

Cloud-Init Script Won't Run?

I am working through this Terraform tutorial, which boots up a Go web app on an EC2 instance, using Terraform and cloud-init. This is my Terraform config file: terraform { required_version = ">= 0.13" required_providers { aws = { …
2
votes
1 answer

How do I install Terraform libvrit_cloudinit?

I have searched all day trying to find a document on how to install the libvirt_cloudinit provider for Terraform. When I execute a terraform plan I encounter this error message: Error: libvirt_cloudinit.commoninit: Provider doesn't support resource:…
Steven K7FAQ
  • 666
  • 1
  • 5
  • 13
2
votes
1 answer

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

prefer_fqdn_over_hostname is documented as, If both fqdn and hostname are set, it is distro dependent whether hostname or fqdn is used, unless the prefer_fqdn_over_hostname option is true and fqdn is set it will force the use of FQDN in all…
Evan Carroll
  • 2,921
  • 6
  • 37
  • 85
1
vote
2 answers

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

I am using Terraform. Terraform has a notion templatefile which can be used to take variables that Terraform has access to (locally supplied or retrieved externally) and to apply them to a Jinja2 template. This specific example is very close to the…
Evan Carroll
  • 2,921
  • 6
  • 37
  • 85
1
vote
1 answer

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

What do you call these variables in my cloud-init file, - http://%(ec2_region)s.ec2.ports.ubuntu.com/ubuntu-ports/ - http://%(availability_zone)s.clouds.ports.ubuntu.com/ubuntu-ports/ - http://%(region)s.clouds.ports.ubuntu.com/ubuntu-ports/ You…
Evan Carroll
  • 2,921
  • 6
  • 37
  • 85
1
vote
1 answer

How to combine cloud-init with Azure ARM Template

I'm trying to set up a Ubuntu Server on Azure. None of the images do quite what I want, so I was planning on taking a vanilla Ubuntu image and using cloud-init to modify it. I'd like to be able to deploy this to multiple environments using Azure…
Martin Brown
  • 111
  • 3
0
votes
0 answers

Cloud-Init on Openstack fails, if security rules limit egress traffic

The Terraform-Code of compute instance: resource "openstack_compute_instance_v2" "my-server" { name = "my-server" image_id = "xxxx" security_groups = [ openstack_networking_secgroup_v2.my_sec_group.name ] user_data =…
Simon_Prewo
  • 101
  • 2
0
votes
1 answer

Can cloud-init install a remotely hosted package with a url that's not in a repository?

I have a package hosted remotely as either a deb or rpm. Does cloud-init support installing packages from hard-coded remote locations. I'm wanting to install GitLab CLI on machines I spin up but GitLab doesn't provide a repository.
Evan Carroll
  • 2,921
  • 6
  • 37
  • 85
0
votes
1 answer

Ubuntu Server 22.04 Autoinstall and Cloud-Init Not Executing Commands

I am trying to set up an Ubuntu Server 22.04 installation using autoinstall and cloud-init. I have two USB keys (I followed this tutorial https://www.jimangel.io/posts/automate-ubuntu-22-04-lts-bare-metal/): One with an ISO image of Ubuntu Server…
Bastien
  • 1
  • 2
0
votes
0 answers

SSH Keys not propagating correctly from instance metadata to authorized_keys: missing keys, user discrepancy, and duplicate key

I want to add eight public keys via instance metadata to avoid adding them manually (i.e.: ssh to VMs, pasting the keys to .ssh/authorized_keys, etc.). I added the keys in Terraform (four distinct keys for two users) using the metadata attribute of…
0
votes
1 answer

Is there a way to pass secrets in cloud-init using Terraform?

Cloud-init has the ability to compliment Terraform in configuring the Virtual Machine it just created. My problem is that cloud-init as uploaded through user-data means that the script especially if multi-part is available on the OpenStack metadata…
Evan Carroll
  • 2,921
  • 6
  • 37
  • 85
0
votes
1 answer

Switching to multi-part cloud-init, getting: SyntaxError: invalid syntax

I used to have user_data = data.template_file.user_data.rendered I changed that to, user_data = data.template_cloudinit_config.master.rendered And I added, data "template_cloudinit_config" "master" { gzip = true base64_encode =…
Evan Carroll
  • 2,921
  • 6
  • 37
  • 85
0
votes
1 answer

Cloud-config in Terraform does not work, nothing seems to happen and it fails silently

I'm currently provisioning a machine with Cloud Config in user_data (I've also tried user_data_base64). When I run my command in Terraform I have, resource "aws_instance" "web" { user_data_base64 =…
Evan Carroll
  • 2,921
  • 6
  • 37
  • 85
1
2