feat: use multiple ssh key in pve_vm module

This commit is contained in:
2025-12-06 16:52:01 +00:00
parent 87c5a9386d
commit 72bf321145
2 changed files with 8 additions and 6 deletions

View File

@@ -26,8 +26,7 @@ resource "proxmox_virtual_environment_file" "cloud_config" {
- name: ${var.vm_user}
groups: sudo
shell: /bin/bash
ssh-authorized-keys:
- "${var.vm_user_sshkey}" # Inject user's SSH key
ssh-authorized-keys: ${jsonencode(var.vm_user_sshkeys)} # Inject user's SSH key
sudo: ALL=(ALL) NOPASSWD:ALL
runcmd:
- systemctl enable qemu-guest-agent

View File

@@ -26,10 +26,13 @@ variable "vm_user" {
default = "vez"
}
variable "vm_user_sshkey" {
description = "Admin user SSH key of the VM"
type = string
default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID62LmYRu1rDUha3timAIcA39LtcIOny1iAgFLnxoBxm vez@bastion"
variable "vm_user_sshkeys" {
description = "Admin user SSH keys of the VM"
type = list(string)
default = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID62LmYRu1rDUha3timAIcA39LtcIOny1iAgFLnxoBxm vez@bastion",
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHovfHKpqTvwj5zrcSuSZALa8iiH6qBvE5dyJCz9eQ2k vez@surface"
]
}
variable "vm_cpu" {