TerraHome/terraform/cloud-init.tf

34 lines
859 B
Terraform
Raw Normal View History

2025-04-17 22:24:54 +01:00
### Global cloud-init template (for all VMs)
2025-04-17 16:46:19 +01:00
2025-04-17 22:24:54 +01:00
data "template_file" "cloud_init_global" {
2025-04-17 22:28:45 +01:00
template = file("${path.module}/files/cloud_init_global.yaml")
2025-04-17 16:46:19 +01:00
vars = {
2025-04-17 22:28:45 +01:00
hostname = "generic"
domain = "home.arpa"
2025-04-17 17:02:46 +01:00
TS_AUTHKEY = var.TS_AUTHKEY
2025-04-18 11:26:17 +01:00
SSH_KEY_PUBLIC = var.SSH_KEY_PUBLIC
2025-04-17 16:46:19 +01:00
}
}
2025-04-17 22:24:54 +01:00
resource "local_file" "cloud_init_global" {
content = data.template_file.cloud_init_global.rendered
filename = "${path.module}/files/cloud_init_global.yaml"
2025-04-17 16:46:19 +01:00
}
2025-04-18 10:51:00 +01:00
#resource "null_resource" "upload_cloud_init_alpaca" {
# count = var.alpaca_vm_count
#
# connection {
# type = "ssh"
# user = "root"
# private_key = var.ssh_key
# host = var.target_node
# }
#
# provisioner "file" {
# source = local_file.cloud_init_alpaca[count.index].filename
# destination = "/var/lib/vz/snippets/cloud_init_alpaca_${count.index + 1}.yaml"
# }
#}