From a05d1f9d4fec8bc270cfa34cfa05a54e5ecb89c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Mon, 17 Feb 2025 18:38:18 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Use=20a=20variable=20for?= =?UTF-8?q?=20proxmox=20VM=20storage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prepare-labs/terraform/providers/proxmox/config.tf | 5 +++++ prepare-labs/terraform/virtual-machines/proxmox/main.tf | 4 ++-- .../terraform/virtual-machines/proxmox/tfvars.example | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/prepare-labs/terraform/providers/proxmox/config.tf b/prepare-labs/terraform/providers/proxmox/config.tf index 105e67d4..e6c3308d 100644 --- a/prepare-labs/terraform/providers/proxmox/config.tf +++ b/prepare-labs/terraform/providers/proxmox/config.tf @@ -13,6 +13,11 @@ variable "proxmox_password" { default = null } +variable "proxmox_storage" { + type = string + default = "local" +} + variable "proxmox_template_node_name" { type = string default = null diff --git a/prepare-labs/terraform/virtual-machines/proxmox/main.tf b/prepare-labs/terraform/virtual-machines/proxmox/main.tf index e767bc76..b74c8754 100644 --- a/prepare-labs/terraform/virtual-machines/proxmox/main.tf +++ b/prepare-labs/terraform/virtual-machines/proxmox/main.tf @@ -18,7 +18,7 @@ resource "proxmox_virtual_environment_vm" "_" { dedicated = split(" ", each.value.node_size)[1] } #disk { - # datastore_id = "ceph" + # datastore_id = var.proxmox_storage # file_id = proxmox_virtual_environment_file._.id # interface = "scsi0" # size = 30 @@ -33,7 +33,7 @@ resource "proxmox_virtual_environment_vm" "_" { enabled = true } initialization { - datastore_id = "ceph" + datastore_id = var.proxmox_storage user_account { username = "ubuntu" keys = [trimspace(tls_private_key.ssh.public_key_openssh)] diff --git a/prepare-labs/terraform/virtual-machines/proxmox/tfvars.example b/prepare-labs/terraform/virtual-machines/proxmox/tfvars.example index e86f5ef7..837b9826 100644 --- a/prepare-labs/terraform/virtual-machines/proxmox/tfvars.example +++ b/prepare-labs/terraform/virtual-machines/proxmox/tfvars.example @@ -8,6 +8,9 @@ proxmox_endpoint = "https://localhost:8006/" proxmox_username = "terraform@pve" proxmox_password = "CHANGEME" +# Which storage to use for VM disks. Defaults to "local". +#proxmox_storage = "ceph" + proxmox_template_node_name = "CHANGEME" proxmox_template_vm_id = CHANGEME