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 \ 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 diff --git a/environments/test/frontend/deployment.tfvars b/environments/test/frontend/deployment.tfvars new file mode 100644 index 0000000..11ab06e --- /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