propagate datastore id

Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
This commit is contained in:
Kiara Grouwstra 2025-10-13 13:58:05 +02:00
parent b0b158050d
commit b5d2b2cb87
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
7 changed files with 47 additions and 3 deletions

View file

@ -30,6 +30,8 @@ let
node-name node-name
bridge bridge
vlanId vlanId
imageDatastoreId
vmDatastoreId
; ;
inherit (lib) mkOption types; inherit (lib) mkOption types;
eval = eval =
@ -344,6 +346,8 @@ let
node-name node-name
bridge bridge
vlanId vlanId
imageDatastoreId
vmDatastoreId
; ;
root-path = pathToRoot; root-path = pathToRoot;
}; };

View file

@ -25,6 +25,8 @@ let
node-name = "pve"; node-name = "pve";
bridge = "br0"; bridge = "br0";
vlanId = 0; vlanId = 0;
imageDatastoreId = "local";
vmDatastoreId = "local";
}; };
# FIXME generate the image `nixos-generate` was to make, but now do it for a desired `-c configuration.nix` rather than whatever generic thing now # FIXME generate the image `nixos-generate` was to make, but now do it for a desired `-c configuration.nix` rather than whatever generic thing now
deployment = deployment =

View file

@ -44,5 +44,15 @@ in
type = types.int; type = types.int;
default = 0; default = 0;
}; };
imageDatastoreId = mkOption {
description = "ID of the datastore of the image.";
type = types.str;
default = "local";
};
vmDatastoreId = mkOption {
description = "ID of the datastore of the VM.";
type = types.str;
default = "local";
};
}; };
} }

View file

@ -364,6 +364,16 @@ let
type = types.int; type = types.int;
default = 0; default = 0;
}; };
imageDatastoreId = mkOption {
description = "ID of the datastore of the image.";
type = types.str;
default = "local";
};
vmDatastoreId = mkOption {
description = "ID of the datastore of the VM.";
type = types.str;
default = "local";
};
run = mkOption { run = mkOption {
type = types.package; type = types.package;
# error: The option `tf-deployment.tf-host.run' is read-only, but it's set multiple times. # error: The option `tf-deployment.tf-host.run' is read-only, but it's set multiple times.
@ -383,6 +393,8 @@ let
node-name node-name
bridge bridge
vlanId vlanId
imageDatastoreId
vmDatastoreId
; ;
inherit (ssh) inherit (ssh)
host host
@ -451,6 +463,8 @@ let
proxmox_password = proxmox-password; proxmox_password = proxmox-password;
ssh_user = username; ssh_user = username;
vlan_id = vlanId; vlan_id = vlanId;
image_datastore_id = imageDatastoreId;
vm_datastore_id = vmDatastoreId;
}; };
tf-env = pkgs.callPackage ./run/tf-env.nix { tf-env = pkgs.callPackage ./run/tf-env.nix {
inherit httpBackend; inherit httpBackend;

View file

@ -75,7 +75,7 @@ resource "proxmox_virtual_environment_file" "upload" {
# https://192.168.51.81:8006/#v1:0:=storage%2Fnode051%2Flocal:4::=contentIso::::: # https://192.168.51.81:8006/#v1:0:=storage%2Fnode051%2Flocal:4::=contentIso:::::
# PVE -> Datacenter -> Storage -> local -> Edit -> General -> Content -> check Import + Disk Images -> OK # PVE -> Datacenter -> Storage -> local -> Edit -> General -> Content -> check Import + Disk Images -> OK
# that UI action also adds it in `/etc/pve/storage.cfg` # that UI action also adds it in `/etc/pve/storage.cfg`
datastore_id = "local" datastore_id = var.image_datastore_id
# datastore_id = "local-lvm" # datastore_id = "local-lvm"
# datastore_id = "backup" # datastore_id = "backup"
node_name = var.node_name node_name = var.node_name
@ -133,7 +133,7 @@ resource "proxmox_virtual_environment_vm" "nix_vm" {
disk { disk {
# datastore_id = "linstor_storage" # datastore_id = "linstor_storage"
datastore_id = "local" datastore_id = var.vm_datastore_id
file_format = "qcow2" file_format = "qcow2"
interface = "scsi0" interface = "scsi0"
discard = "on" discard = "on"
@ -154,7 +154,7 @@ resource "proxmox_virtual_environment_vm" "nix_vm" {
efi_disk { efi_disk {
# datastore_id = "linstor_storage" # datastore_id = "linstor_storage"
datastore_id = "local" datastore_id = var.vm_datastore_id
file_format = "qcow2" file_format = "qcow2"
type = "4m" type = "4m"
} }

View file

@ -64,6 +64,18 @@ variable "vlan_id" {
default = 0 default = 0
} }
variable "image_datastore_id" {
description = "ID of the datastore of the image."
type = string
default = "local"
}
variable "vm_datastore_id" {
description = "ID of the datastore of the VM."
type = string
default = "local"
}
######################################### #########################################
variable "category" { variable "category" {

View file

@ -97,6 +97,8 @@
node-name = "node051"; node-name = "node051";
bridge = "ovsbr0"; bridge = "ovsbr0";
vlanId = 1305; vlanId = 1305;
imageDatastoreId = "local";
vmDatastoreId = "linstor_storage";
}; };
# opt not to pass `inputs`, as we could only pass serializable arguments through to its self-call # opt not to pass `inputs`, as we could only pass serializable arguments through to its self-call
})."tf-proxmox-deployment".tf-proxmox-host; })."tf-proxmox-deployment".tf-proxmox-host;