ci: fix duplicate id #326
This file contains 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: tofu | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
workflow_dispatch: | |
schedule: | |
- cron: "0 4 * * *" | |
permissions: | |
pull-requests: write | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }} | |
jobs: | |
linode: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: opentofu/setup-opentofu@v1 | |
- env: | |
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }} | |
PG_CONN_STR: ${{ secrets.PG_CONN_STR }} | |
TF_VAR_bitwarden_token: ${{ secrets.BITWARDEN_TOKEN }} | |
TF_VAR_discord_webhook: ${{ secrets.DISCORD_WEBHOOK_FLUX_EU_1 }} | |
TF_VAR_github_token: ${{ secrets.PAT }} | |
run: | | |
tofu -chdir=./terraform/linode init -upgrade | |
- if: github.event_name == 'pull_request' | |
id: plan | |
env: | |
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }} | |
PG_CONN_STR: ${{ secrets.PG_CONN_STR }} | |
TF_VAR_bitwarden_token: ${{ secrets.BITWARDEN_TOKEN }} | |
TF_VAR_discord_webhook: ${{ secrets.DISCORD_WEBHOOK_FLUX_EU_1 }} | |
TF_VAR_github_token: ${{ secrets.PAT }} | |
run: | | |
tofu -chdir=./terraform/linode plan -input=false -no-color | tee plan.txt | |
echo plan="$(cat plan.txt)" >> ${GITHUB_OUTPUT} | |
- if: github.event_name == 'pull_request' | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
header: linode Terraform Plan | |
message: | | |
```terraform | |
${{ steps.plan.outputs.plan }} | |
``` | |
- if: github.event_name != 'pull_request' | |
env: | |
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }} | |
PG_CONN_STR: ${{ secrets.PG_CONN_STR }} | |
TF_VAR_bitwarden_token: ${{ secrets.BITWARDEN_TOKEN }} | |
TF_VAR_discord_webhook: ${{ secrets.DISCORD_WEBHOOK_FLUX_EU_1 }} | |
TF_VAR_github_token: ${{ secrets.PAT }} | |
run: | | |
tofu -chdir=./terraform/linode \ | |
apply -auto-approve -input=false -lock=true -no-color | |
oci: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: opentofu/setup-opentofu@v1 | |
- env: | |
PG_CONN_STR: ${{ secrets.PG_CONN_STR }} | |
TF_VAR_fingerprint: ${{ secrets.OCI_FINGERPRINT }} | |
TF_VAR_private_key: ${{ secrets.OCI_PEM_PRV }} | |
TF_VAR_ssh_public_keys: ${{ secrets.SSH_PUB_KEY }} | |
TF_VAR_tailscale_oauth_client_id: ${{ secrets.TAILSCALE_OAUTH_CLIENT_ID }} | |
TF_VAR_tailscale_oauth_secret: ${{ secrets.TAILSCALE_OAUTH_SECRET }} | |
TF_VAR_tenancy_ocid: ${{ secrets.OCI_TENANCY_OCID }} | |
TF_VAR_user_ocid: ${{ secrets.OCI_USER_OCID }} | |
run: | | |
tofu -chdir=./terraform/oci init -upgrade | |
- if: github.event_name == 'pull_request' | |
id: plan | |
env: | |
PG_CONN_STR: ${{ secrets.PG_CONN_STR }} | |
TF_VAR_fingerprint: ${{ secrets.OCI_FINGERPRINT }} | |
TF_VAR_private_key: ${{ secrets.OCI_PEM_PRV }} | |
TF_VAR_ssh_public_keys: ${{ secrets.SSH_PUB_KEY }} | |
TF_VAR_tailscale_oauth_client_id: ${{ secrets.TAILSCALE_OAUTH_CLIENT_ID }} | |
TF_VAR_tailscale_oauth_secret: ${{ secrets.TAILSCALE_OAUTH_SECRET }} | |
TF_VAR_tenancy_ocid: ${{ secrets.OCI_TENANCY_OCID }} | |
TF_VAR_user_ocid: ${{ secrets.OCI_USER_OCID }} | |
run: | | |
tofu -chdir=./terraform/oci plan -input=false -no-color | tee plan.txt | |
echo plan="$(cat plan.txt)" >> ${GITHUB_OUTPUT} | |
- if: github.event_name == 'pull_request' | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
header: oci Terraform Plan | |
message: | | |
```terraform | |
${{ steps.plan.outputs.plan }} | |
``` | |
- if: github.event_name != 'pull_request' | |
env: | |
PG_CONN_STR: ${{ secrets.PG_CONN_STR }} | |
TF_VAR_fingerprint: ${{ secrets.OCI_FINGERPRINT }} | |
TF_VAR_private_key: ${{ secrets.OCI_PEM_PRV }} | |
TF_VAR_ssh_public_keys: ${{ secrets.SSH_PUB_KEY }} | |
TF_VAR_tailscale_oauth_client_id: ${{ secrets.TAILSCALE_OAUTH_CLIENT_ID }} | |
TF_VAR_tailscale_oauth_secret: ${{ secrets.TAILSCALE_OAUTH_SECRET }} | |
TF_VAR_tenancy_ocid: ${{ secrets.OCI_TENANCY_OCID }} | |
TF_VAR_user_ocid: ${{ secrets.OCI_USER_OCID }} | |
run: | | |
tofu -chdir=./terraform/oci \ | |
apply -auto-approve -input=false -lock=true -no-color | |
gcloud: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: opentofu/setup-opentofu@v1 | |
- env: | |
PG_CONN_STR: ${{ secrets.PG_CONN_STR }} | |
run: | | |
tofu -chdir=./terraform/gcloud init -upgrade | |
- if: github.event_name == 'pull_request' | |
id: plan | |
env: | |
PG_CONN_STR: ${{ secrets.PG_CONN_STR }} | |
run: | | |
tofu -chdir=./terraform/gcloud plan -input=false -no-color | tee plan.txt | |
echo plan="$(cat plan.txt)" >> ${GITHUB_OUTPUT} | |
- if: github.event_name == 'pull_request' | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
header: gcloud Terraform Plan | |
message: | | |
```terraform | |
${{ steps.plan.outputs.plan }} | |
``` | |
- if: github.event_name != 'pull_request' | |
env: | |
PG_CONN_STR: ${{ secrets.PG_CONN_STR }} | |
run: | | |
tofu -chdir=./terraform/gcloud \ | |
apply -auto-approve -input=false -lock=true -no-color |