feat: support SSH public key content for CI
Use admin_ssh_public_key content when provided, otherwise fall back to reading from admin_ssh_public_key_path file.
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
# Fichier: terraform/prod/02-cloud-init.tf
|
||||
|
||||
locals {
|
||||
# Utilise le contenu direct si fourni (CI), sinon lit depuis le fichier (local)
|
||||
ssh_public_key = var.admin_ssh_public_key != "" ? var.admin_ssh_public_key : file(var.admin_ssh_public_key_path)
|
||||
}
|
||||
|
||||
resource "proxmox_virtual_environment_file" "cloud_config" {
|
||||
for_each = var.virtual_machines
|
||||
|
||||
@@ -11,7 +16,7 @@ resource "proxmox_virtual_environment_file" "cloud_config" {
|
||||
data = templatefile("${path.module}/../../cloud-init/user-data.yml.tftpl", {
|
||||
# Variables pour définir les informations de l'utilisateur
|
||||
username = lookup(each.value, "username", var.default_vm_user)
|
||||
ssh_key = file(var.admin_ssh_public_key_path)
|
||||
ssh_key = local.ssh_public_key
|
||||
|
||||
# Variables pour définir les informations de la VM
|
||||
hostname = "${each.key}.${var.domain_suffix}"
|
||||
|
||||
Reference in New Issue
Block a user