我该如何使用terraform向gcp实例发送cloud-init脚本?
相关文档非常稀少。请参考文档。
相关文档非常稀少。请参考文档。
#cloud-config
# Create an empty file on the system
write_files:
- path: /root/CLOUD_INIT_WAS_HERE
gzip
和base64_encode
必须设置为false
(它们默认为true
)。
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}"
}