Skip to content

Commit dbd860e

Browse files
committed
chore(dogfood): use remote tf state
1 parent 6f9b3c1 commit dbd860e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/dogfood.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ on:
1717
- "flake.nix"
1818
workflow_dispatch:
1919

20+
21+
permissions:
22+
# Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
23+
id-token: write
24+
2025
jobs:
2126
build_image:
2227
if: github.actor != 'dependabot[bot]' # Skip Dependabot PRs
@@ -85,6 +90,12 @@ jobs:
8590
- name: Setup Terraform
8691
uses: ./.github/actions/setup-tf
8792

93+
- name: Authenticate to Google Cloud
94+
uses: google-github-actions/auth@v2
95+
with:
96+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_ID_PROVIDER }}
97+
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com
98+
8899
- name: Terraform init and validate
89100
run: |
90101
cd dogfood
@@ -118,3 +129,4 @@ jobs:
118129
TF_VAR_CODER_TEMPLATE_VERSION: ${{ steps.vars.outputs.sha_short }}
119130
TF_VAR_CODER_TEMPLATE_DIR: ./contents
120131
TF_VAR_CODER_TEMPLATE_MESSAGE: ${{ steps.message.outputs.pr_title }}
132+
TF_LOG: info

dogfood/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ terraform {
44
source = "coder/coderd"
55
}
66
}
7+
backend "gcs" {
8+
bucket = "coder-dogfood-tf-state"
9+
}
710
}
811

9-
// Alternative to committing a state file
1012
import {
1113
to = coderd_template.dogfood
1214
id = "0d286645-29aa-4eaf-9b52-cc5d2740c90b"

0 commit comments

Comments
 (0)