terraform/.forgejo/workflows/non-lab.yml

51 lines
1.9 KiB
YAML
Raw Normal View History

2024-09-02 11:20:23 +02:00
on:
push:
branches:
- 'main'
2024-09-02 08:44:17 +00:00
2024-09-02 10:32:51 +02:00
jobs:
2024-09-02 10:50:35 +02:00
non-lab:
2024-09-02 10:32:51 +02:00
runs-on: docker
2024-09-02 09:00:46 +00:00
#container:
# image: ghcr.io/opentofu/opentofu:1.7.2
2024-09-02 10:32:51 +02:00
steps:
2024-09-02 10:56:38 +02:00
- uses: actions/checkout@v4
with:
sparse-checkout: |
non-lab
2024-09-02 15:57:32 +02:00
#- uses: https://code.lab.cowley.tech/homelab/forgejo-opentofu-runner@main
- name: Setup OpenTofu
run: |
curl -fsSl https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh
chmod +x /tmp/install-opentofu.sh
/tmp/install-opentofu.sh --install-method deb
rm -f /tmp/install-opentofu.sh
2024-09-02 16:30:54 +02:00
- name: Tofu init
working-directory: ${{ github.workspace }}/non-lab
2024-09-02 15:57:32 +02:00
run: |
export KUBE_CONFIG_PATH="/tmp/kubeconfig"
2024-09-02 16:30:54 +02:00
echo ${{ secrets.KUBE_CONFIG_BASE64 }} | base64 -d > ${KUBE_CONFIG_PATH}
2024-09-02 15:57:32 +02:00
export B2_APPLICATION_KEY_ID=${{ secrets.B2_APPLICATION_KEY_ID }}
export B2_APPLICATION_KEY=${{ secrets.B2_APPLICATION_KEY }}
tofu init
2024-09-02 16:03:40 +02:00
- name: Tofu Plan
working-directory: ${{ github.workspace }}/non-lab
run: |
2024-09-13 09:37:49 +00:00
export KUBE_CONFIG_PATH="/tmp/kubeconfig"
echo ${{ secrets.KUBE_CONFIG_BASE64 }} | base64 -d > ${KUBE_CONFIG_PATH}
export B2_APPLICATION_KEY_ID=${{ secrets.B2_APPLICATION_KEY_ID }}
export B2_APPLICATION_KEY=${{ secrets.B2_APPLICATION_KEY }}
2024-09-02 16:03:40 +02:00
tofu plan -out tfplan
2024-09-13 09:58:47 +00:00
#- uses: https://code.forgejo.org/forgejo/upload-artifact@v4
# with:
# name: plan
# path: ${{ github.workspace }}/non-lab/tfplan
- name: Tofu Apply
working-directory: ${{ github.workspace }}/non-lab
run: |
export KUBE_CONFIG_PATH="/tmp/kubeconfig"
echo ${{ secrets.KUBE_CONFIG_BASE64 }} | base64 -d > ${KUBE_CONFIG_PATH}
export B2_APPLICATION_KEY_ID=${{ secrets.B2_APPLICATION_KEY_ID }}
export B2_APPLICATION_KEY=${{ secrets.B2_APPLICATION_KEY }}
ls -la