How do I send cloud-init script to a gcp instance using terraform?
Documentation is very sparse around this topic.
How do I send cloud-init script to a gcp instance using terraform?
Documentation is very sparse around this topic.
You need the following:
#cloud-config
# Create an empty file on the system
write_files:
- path: /root/CLOUD_INIT_WAS_HERE
gzip
and base64_encode
must be set to false
(they are true
by default).
data "cloudinit_config" "conf" {
gzip = false
base64_encode = false
part {
content_type = "text/cloud-config"
content = file("conf.yaml")
filename = "conf.yaml"
}
}
metadata = {
user-data = "${data.cloudinit_config.conf.rendered}"
}
© 2022 - 2024 — McMap. All rights reserved.