From 0fb2323b9a6a47ca6d09abcd54df5117b35d5c53 Mon Sep 17 00:00:00 2001 From: Pal Kerecsenyi Date: Tue, 2 Apr 2024 17:15:01 +0100 Subject: [PATCH] Add terraform deploy script --- .../workflows/palcloud-terraform-deploy.yml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/palcloud-terraform-deploy.yml diff --git a/.github/workflows/palcloud-terraform-deploy.yml b/.github/workflows/palcloud-terraform-deploy.yml new file mode 100644 index 0000000..ba70b90 --- /dev/null +++ b/.github/workflows/palcloud-terraform-deploy.yml @@ -0,0 +1,41 @@ +on: + workflow_call: + inputs: + terraform-directory: + type: string + default: terraform + variable-map: + type: string + default: "{}" + secrets: + PALTIVERSE_K8S: + required: true + TAILSCALE_TOKEN: + required: true +jobs: + deploy-palcloud-terraform: + runs-on: ubuntu-latest + container: alpine:3 + env: ${{ fromJSON(inputs.variable-map) }} + steps: + - name: Install Alpine dependencies + run: apk add nodejs npm git + - name: Install Terraform + uses: https://gitea.palk.me/paltiverse/paltiverse-actions-setup-terraform@0.0.2 + - name: Connect to Paltiverse and configure kubectl + uses: https://gitea.palk.me/paltiverse/paltiverse-actions-kubectl@1.0.3 + id: kubectl + with: + tailscale-token: ${{ secrets.TAILSCALE_TOKEN }} + k8s-config: ${{ secrets.PALTIVERSE_K8S }} + - uses: actions/checkout@v4 + - name: Initialise Terraform (download providers) + run: terraform init + working-directory: ${{ inputs.terraform-directory }} + - name: Apply Terraform plan + run: terraform apply -auto-approve -lock-timeout=30s + working-directory: ${{ inputs.terraform-directory }} + env: + HTTP_PROXY: ${{ steps.kubectl.outputs.http-proxy }} + HTTPS_PROXY: ${{ steps.kubectl.outputs.http-proxy }} + TF_VAR_kube_config_path: ${{ steps.kubectl.outputs.k8s-config-path }}