Crypto Alert

Takeaways

Authenticating Terraform Cloud on GCP needs a GOOGLE_SERVICE_ACCOUNT as environment variable configured there https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#using-terraform-cloud

GitHub Actions config

Required secrets:

  • TF_API_TOKEN - view Terraform User Token
  • WIF_PROVIDER - view Workload Identity Federation Provider
  • WIF_SERVICE_ACCOUNT - view WIF Service Account

Terraform User Token

Access Token Page

Workload Identity Federation Provider

google-auth action tutorial

Retrieve pool name:

gcloud iam workload-identity-pools providers describe "ts-crypto-alert" \
  --project="crypto-alert-421018" \
  --location="global" \
  --workload-identity-pool="github" \
  --format="value(name)"

WIF Service Account

Go to your WIF Provider: https://console.cloud.google.com/iam-admin/workload-identity-pools/pool/github On Connected Service Accounts click on Download to copy the full value, e.g. <name>@<project>.iam.gserviceaccount.com

Gotchas

Function "" is not defined in the provided module

I was getting the following error:

Function "" is not defined in the provided module

Even if it follows naming rules and had logs telling me that it was being added to functions framework

The real problem was the missing functions-framework on dependencies (not devDependencies) as we see on this issue

References

Discord message colors and emoji