From 73c145707a6a343ca73df24b7e2101ad139e7cc1 Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:25:26 +0100 Subject: [PATCH 1/4] chore(gitignore): allow tracking deployment variable files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 539d612..59a0892 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,9 @@ crash.*.log *.tfvars *.tfvars.json +# Allow version-controlled deployment configurations +!**/deployment.tfvars + # Plans *.tfplan tfplan From c50c4f919ca94ef658d81c0339696bfefa184ae2 Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:26:37 +0100 Subject: [PATCH 2/4] feat(config): add TEST deployment variable files --- environments/test/frontend/deployment.tfvars | 9 +++++++++ environments/test/network/deployment.tfvars | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 environments/test/frontend/deployment.tfvars create mode 100644 environments/test/network/deployment.tfvars diff --git a/environments/test/frontend/deployment.tfvars b/environments/test/frontend/deployment.tfvars new file mode 100644 index 0000000..d4a4e9e --- /dev/null +++ b/environments/test/frontend/deployment.tfvars @@ -0,0 +1,9 @@ +frontend_name = "assignment2-test-frontend" +frontend_count = 1 + +frontend_image = "Debian 13 (Trixie) stable amd64" +frontend_flavor = "gx1.1c1r" + +http_cidr = "0.0.0.0/0" + +external_network_name = "ntnu-internal" \ No newline at end of file diff --git a/environments/test/network/deployment.tfvars b/environments/test/network/deployment.tfvars new file mode 100644 index 0000000..e92eba6 --- /dev/null +++ b/environments/test/network/deployment.tfvars @@ -0,0 +1,13 @@ +network_name = "assignment2-test-network" + +frontend_subnet_name = "test-frontend-subnet" +frontend_subnet_cidr = "10.60.10.0/24" + +backend_subnet_name = "test-backend-subnet" +backend_subnet_cidr = "10.60.20.0/24" + +database_subnet_name = "test-database-subnet" +database_subnet_cidr = "10.60.30.0/24" + +router_name = "assignment2-test-router" +external_network_name = "ntnu-internal" \ No newline at end of file From ee5d842fc413c0180aebcfea18e7e490c3f14e93 Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:28:01 +0100 Subject: [PATCH 3/4] fix(cd): load TEST variables during infrastructure planning --- .github/workflows/deploy.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6387991..3fa8d83 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -224,14 +224,23 @@ jobs: shell: bash env: TF_IN_AUTOMATION: "true" + TF_VAR_admin_cidr: ${{ secrets.ADMIN_CIDR }} + TF_VAR_ssh_key_name: ${{ vars.SSH_KEY_NAME }} run: | set -euo pipefail + + : "${TF_VAR_admin_cidr:?Missing ADMIN_CIDR secret}" + : "${TF_VAR_ssh_key_name:?Missing SSH_KEY_NAME variable}" + + test -f environments/test/network/deployment.tfvars + test -f environments/test/frontend/deployment.tfvars for STACK in network frontend; do echo "::group::TEST $STACK plan" set +e tofu -chdir="environments/test/$STACK" plan \ + -var-file="deployment.tfvars" \ -input=false \ -no-color \ -lock-timeout=5m \ From 874eb077c3634f8f5cf2c09fc7e0e61030cf4a8e Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:31:38 +0100 Subject: [PATCH 4/4] style(tofu): format TEST frontend variables --- environments/test/frontend/deployment.tfvars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environments/test/frontend/deployment.tfvars b/environments/test/frontend/deployment.tfvars index d4a4e9e..11ab06e 100644 --- a/environments/test/frontend/deployment.tfvars +++ b/environments/test/frontend/deployment.tfvars @@ -4,6 +4,6 @@ frontend_count = 1 frontend_image = "Debian 13 (Trixie) stable amd64" frontend_flavor = "gx1.1c1r" -http_cidr = "0.0.0.0/0" +http_cidr = "0.0.0.0/0" external_network_name = "ntnu-internal" \ No newline at end of file