Skip to content

chore(dogfood): use remote tf state #14363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/dogfood.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
- "flake.nix"
workflow_dispatch:

permissions:
# Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
id-token: write

jobs:
build_image:
if: github.actor != 'dependabot[bot]' # Skip Dependabot PRs
Expand Down Expand Up @@ -85,6 +89,12 @@ jobs:
- name: Setup Terraform
uses: ./.github/actions/setup-tf

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/573722524737/locations/global/workloadIdentityPools/github/providers/github
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com

- name: Terraform init and validate
run: |
cd dogfood
Expand All @@ -110,11 +120,12 @@ jobs:
cd dogfood
terraform apply -auto-approve
env:
# Consumed by Coder CLI
# Consumed by coderd provider
CODER_URL: https://dev.coder.com
CODER_SESSION_TOKEN: ${{ secrets.CODER_SESSION_TOKEN }}
# Template source & details
TF_VAR_CODER_TEMPLATE_NAME: ${{ secrets.CODER_TEMPLATE_NAME }}
TF_VAR_CODER_TEMPLATE_VERSION: ${{ steps.vars.outputs.sha_short }}
TF_VAR_CODER_TEMPLATE_DIR: ./contents
TF_VAR_CODER_TEMPLATE_MESSAGE: ${{ steps.message.outputs.pr_title }}
TF_LOG: info
4 changes: 3 additions & 1 deletion dogfood/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ terraform {
source = "coder/coderd"
}
}
backend "gcs" {
bucket = "coder-dogfood-tf-state"
}
}

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