Combine Hetzner LB's #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Apply Terraform plan | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'infrastructure/**' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| apply: | |
| runs-on: ubuntu-latest | |
| name: Apply Terraform plan | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TF_VAR_hcloud_token: ${{ secrets.TF_HCLOUD_TOKEN }} | |
| STATE_BUCKET_NAME: ${{ secrets.TF_STATE_BUCKET_NAME }} | |
| STATE_BUCKET_KEY: ${{ secrets.TF_STATE_BUCKET_KEY }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.TF_STATE_ACCESS_KEY }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.TF_STATE_SECRET_KEY }} | |
| AWS_CA_BUNDLE: "" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Terraform apply | |
| uses: dflook/terraform-apply@v2 | |
| with: | |
| path: infrastructure | |
| backend_config: bucket=${{ env.STATE_BUCKET_NAME }} key=${{ env.STATE_BUCKET_KEY }} | |
| env: | |
| TERRAFORM_PRE_RUN: | | |
| # Install prerequisites | |
| apt update | |
| apt install -y lsb-release | |
| # Install latest Packer | |
| wget -O - https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg | |
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list | |
| apt install -y packer | |
| # Install latest Talosctl | |
| curl -sL https://talos.dev/install | sh |