Compare commits

...

3 commits

6 changed files with 13 additions and 64 deletions

View file

@ -19,10 +19,6 @@ let
in in
{ {
_class = "nixosTest"; _class = "nixosTest";
imports = [
./options.nix
];
name = "deployment-model"; name = "deployment-model";
sourceFileset = lib.fileset.unions [ sourceFileset = lib.fileset.unions [
../../data-model.nix ../../data-model.nix
@ -31,7 +27,6 @@ in
../../run/ssh-single-host/run.sh ../../run/ssh-single-host/run.sh
../../../npins/default.nix ../../../npins/default.nix
../../../npins/sources.json ../../../npins/sources.json
./options.nix
./constants.nix ./constants.nix
]; ];

View file

@ -1,15 +0,0 @@
{
lib,
...
}:
let
inherit (lib) mkOption types;
in
{
options = {
targetSystem = mkOption {
type = types.str;
description = "name of the host to deploy to";
};
};
}

View file

@ -28,10 +28,6 @@ let
in in
{ {
_class = "nixosTest"; _class = "nixosTest";
imports = [
./options.nix
];
name = "deployment-model"; name = "deployment-model";
sourceFileset = lib.fileset.unions [ sourceFileset = lib.fileset.unions [
../../run/tf-single-host/run.sh ../../run/tf-single-host/run.sh

View file

@ -1,25 +0,0 @@
{
lib,
...
}:
let
inherit (lib) mkOption types;
in
{
options = {
targetSystem = mkOption {
type = types.str;
description = "name of the host to deploy to";
};
sshOpts = mkOption {
description = "Extra SSH options (`-o`) to use.";
type = types.listOf types.str;
default = [ ];
example = "ConnectTimeout=60";
};
httpBackend = mkOption {
description = "environment variables to configure the TF HTTP back-end, see <https://developer.hashicorp.com/terraform/language/backend/http#configuration-variables>";
type = types.attrsOf (types.either types.str types.int);
};
};
}

View file

@ -15,7 +15,7 @@ in
{ {
name = "proxmox-basic"; name = "proxmox-basic";
nodes.mypve = nodes.pve =
{ sources, ... }: { sources, ... }:
{ {
imports = [ imports = [
@ -44,41 +44,41 @@ in
}; };
testScript = '' testScript = ''
machine.start() pve.start()
machine.wait_for_unit("pveproxy.service") pve.wait_for_unit("pveproxy.service")
assert "running" in machine.succeed("pveproxy status") assert "running" in pve.succeed("pveproxy status")
# Copy Iso # Copy Iso
machine.succeed("mkdir -p /var/lib/vz/template/iso/") pve.succeed("mkdir -p /var/lib/vz/template/iso/")
machine.succeed("cp ${minimalIso} /var/lib/vz/template/iso/minimal.iso") pve.succeed("cp ${minimalIso} /var/lib/vz/template/iso/minimal.iso")
# Declarative VM creation # Declarative VM creation
machine.wait_for_unit("multi-user.target") pve.wait_for_unit("multi-user.target")
machine.succeed("qm stop 100 --timeout 0") pve.succeed("qm stop 100 --timeout 0")
# Seabios VM creation # Seabios VM creation
machine.succeed( pve.succeed(
"qm create 101 --kvm 0 --bios seabios -cdrom local:iso/minimal.iso", "qm create 101 --kvm 0 --bios seabios -cdrom local:iso/minimal.iso",
"qm start 101", "qm start 101",
"qm stop 101 --timeout 0" "qm stop 101 --timeout 0"
) )
# Legacy ovmf vm creation # Legacy ovmf vm creation
machine.succeed( pve.succeed(
"qm create 102 --kvm 0 --bios ovmf -cdrom local:iso/minimal.iso", "qm create 102 --kvm 0 --bios ovmf -cdrom local:iso/minimal.iso",
"qm start 102", "qm start 102",
"qm stop 102 --timeout 0" "qm stop 102 --timeout 0"
) )
# UEFI ovmf vm creation # UEFI ovmf vm creation
machine.succeed( pve.succeed(
"qm create 103 --kvm 0 --bios ovmf --efidisk0 local:4,efitype=4m -cdrom local:iso/minimal.iso", "qm create 103 --kvm 0 --bios ovmf --efidisk0 local:4,efitype=4m -cdrom local:iso/minimal.iso",
"qm start 103", "qm start 103",
"qm stop 103 --timeout 0" "qm stop 103 --timeout 0"
) )
# UEFI ovmf vm creation with secure boot # UEFI ovmf vm creation with secure boot
machine.succeed( pve.succeed(
"qm create 104 --kvm 0 --bios ovmf --efidisk0 local:4,efitype=4m,pre-enrolled-keys=1 -cdrom local:iso/minimal.iso", "qm create 104 --kvm 0 --bios ovmf --efidisk0 local:4,efitype=4m,pre-enrolled-keys=1 -cdrom local:iso/minimal.iso",
"qm start 104", "qm start 104",
"qm stop 104 --timeout 0" "qm stop 104 --timeout 0"

View file

@ -1,9 +1,7 @@
#! /usr/bin/env bash #! /usr/bin/env bash
set -xeuo pipefail set -euo pipefail
declare tf_env declare tf_env
export TF_LOG=info
cd "${tf_env}/deployment/run/tf-single-host" cd "${tf_env}/deployment/run/tf-single-host"
# parallelism=1: limit OOM risk # parallelism=1: limit OOM risk
tofu apply --auto-approve -parallelism=1 tofu apply --auto-approve -parallelism=1