Skip to content

Terraform Apply VyOS #4

Terraform Apply VyOS

Terraform Apply VyOS #4

name: "Terraform Apply VyOS"
on:
push:
branches:
- main
paths:
- 'terraform/vyos/**'
workflow_dispatch:
concurrency: terraform
jobs:
terraform:
name: "Terraform"
runs-on: ubuntu-latest
container:
image: ghcr.io/lab-astr0rack-net/terraform:latest
options: --cap-add=NET_ADMIN --cap-add=NET_RAW --dns=1.1.1.1 --dns=100.100.100.100 --add-host postgres.lab.astr0rack.net:192.168.55.2 --add-host proxmox.lab.astr0rack.net:192.168.55.2
volumes:
- /var/lib:/var/lib
- /dev/net/tun:/dev/net/tun
defaults:
run:
working-directory: terraform/vyos
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
- name: Terraform Format
id: fmt
run: terraform fmt -check
- name: Tailscale
uses: tailscale/github-action@v1
id: ts-login
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
- name: Terraform Init
env:
PG_CONN_STR: ${{ secrets.TF_POSTGRES_CRED }}
PG_SCHEMA_NAME: vyos
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Apply
if: (github.ref == 'refs/heads/main' ) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
env:
TF_VAR_pm_password: ${{ secrets.TF_PROXMOX_PASSWORD }}
PG_CONN_STR: ${{ secrets.TF_POSTGRES_CRED }}
PG_SCHEMA_NAME: vyos
run: terraform apply -auto-approve -input=false
- name: Logout of Tailscale
id: ts-logout
if: steps.ts-login.conclusion == 'success'
run: sudo tailscale logout
- name: Notify discord
uses: up9cloud/[email protected]
if: cancelled() == false
env:
GITHUB_JOB_STATUS: ${{ job.status }}
DISCORD_WEBHOOK_URL: ${{ secrets.LAB_DISCORD_WEBHOOK }}