Skip to content

Commit d9f4193

Browse files
chore(dogfood): use remote tf state (coder#14363)
1 parent b6d35ed commit d9f4193

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.github/workflows/dogfood.yaml

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

20+
permissions:
21+
# Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
22+
id-token: write
23+
2024
jobs:
2125
build_image:
2226
if: github.actor != 'dependabot[bot]' # Skip Dependabot PRs
@@ -85,6 +89,12 @@ jobs:
8589
- name: Setup Terraform
8690
uses: ./.github/actions/setup-tf
8791

92+
- name: Authenticate to Google Cloud
93+
uses: google-github-actions/auth@v2
94+
with:
95+
workload_identity_provider: projects/573722524737/locations/global/workloadIdentityPools/github/providers/github
96+
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com
97+
8898
- name: Terraform init and validate
8999
run: |
90100
cd dogfood
@@ -110,11 +120,12 @@ jobs:
110120
cd dogfood
111121
terraform apply -auto-approve
112122
env:
113-
# Consumed by Coder CLI
123+
# Consumed by coderd provider
114124
CODER_URL: https://dev.coder.com
115125
CODER_SESSION_TOKEN: ${{ secrets.CODER_SESSION_TOKEN }}
116126
# Template source & details
117127
TF_VAR_CODER_TEMPLATE_NAME: ${{ secrets.CODER_TEMPLATE_NAME }}
118128
TF_VAR_CODER_TEMPLATE_VERSION: ${{ steps.vars.outputs.sha_short }}
119129
TF_VAR_CODER_TEMPLATE_DIR: ./contents
120130
TF_VAR_CODER_TEMPLATE_MESSAGE: ${{ steps.message.outputs.pr_title }}
131+
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)