From 19678552e64b7fea14299e6e7f20bd501b0d0c6e Mon Sep 17 00:00:00 2001 From: Tine Date: Thu, 22 Aug 2024 18:16:39 +0200 Subject: [PATCH] feat: tfvars, efi and pushing to code.tjo.space --- .gitignore | 4 ++-- justfile | 18 +++++++++++++++--- terraform/node.tf | 3 +++ terraform/terraform.tfvars | 16 ++++++++++++++++ 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 terraform/terraform.tfvars diff --git a/.gitignore b/.gitignore index 27a9393..57680aa 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,8 @@ crash.*.log # password, private keys, and other secrets. These should not be part of version # control as they are data points which are potentially sensitive and subject # to change depending on the environment. -*.tfvars -*.tfvars.json +#*.tfvars +#*.tfvars.json # Ignore override files as they are usually used to override resources locally and so # are not checked in diff --git a/justfile b/justfile index 563011e..4cd66ab 100644 --- a/justfile +++ b/justfile @@ -15,11 +15,23 @@ lint: build: @nix build .#vm +push: + #!/usr/bin/env sh + export NIXOS_IMAGE=$(nix path-info --quiet .#vm)/nixos.qcow2 + export VERSION=$(echo $NIXOS_IMAGE | cut -d'/' -f4 | cut -d'-' -f1) + + echo "Uploading $NIXOS_IMAGE to code.tjo.space" + echo "Version: $VERSION" + + curl --user $CODE_TJO_SPACE_USER:$CODE_TJO_SPACE_TOKEN \ + --progress-bar \ + --upload-file $NIXOS_IMAGE \ + https://code.tjo.space/api/packages/tjo-cloud/generic/ingress/${VERSION}/nixos.qcow2 + deploy: #!/usr/bin/env sh - export NIX_RESULT_DIR=$(nix build --print-out-paths .#vm) - export IMAGE_NAME=$(ls ${NIX_RESULT_DIR} | grep ".qcow2") - export TF_VAR_image_path=${NIX_RESULT_DIR}/${IMAGE_NAME} + export NIXOS_IMAGE=$(nix path-info --quiet .#vm)/nixos.qcow2 + export TF_VAR_image_path=$NIXOS_IMAGE cd {{justfile_directory()}}/terraform tofu init diff --git a/terraform/node.tf b/terraform/node.tf index 7adbb2b..1ddc2af 100644 --- a/terraform/node.tf +++ b/terraform/node.tf @@ -89,6 +89,9 @@ resource "proxmox_virtual_environment_vm" "nodes" { } bios = "ovmf" + efi_disk { + datastore_id = each.value.storage + } operating_system { type = "l26" diff --git a/terraform/terraform.tfvars b/terraform/terraform.tfvars new file mode 100644 index 0000000..d62c8e1 --- /dev/null +++ b/terraform/terraform.tfvars @@ -0,0 +1,16 @@ +nodes = { + de_01 = { + name = "de-01" + host = "hetzner" + bridge = "vmprivate0" + cloudinit = "" + } + de_02 = { + name = "de-02" + host = "hetzner" + bridge = "vmprivate0" + cloudinit = "" + } +} + +common_storage = "proxmox-backup-tjo-cloud"