Prerequisites
Prerequisites
- A Checkly Monitoring as Code project with its dependencies and lockfile committed.
CHECKLY_ACCOUNT_IDstored as a GitHub Actions variable.- The Checkly API key and required deployment values stored as enabled secret versions in Google Secret Manager.
- A Google Cloud project with the IAM, Resource Manager, Service Account Credentials, Security Token Service, and Secret Manager APIs enabled.
- Permission to configure Workload Identity Federation, service account impersonation, and IAM access on the required secrets.
This guide uses a fictional payments service; replace its names and URL with
your own application values. Checkly requires
CHECKLY_API_KEY and
CHECKLY_ACCOUNT_ID; the GCP_* variables configure this workflow.Configure Google Cloud access
Follow Google’s deployment pipeline guide or thegoogle-github-actions/auth instructions to configure Workload Identity Federation and a dedicated service account.
Restrict the Workload Identity Provider to the repository and ref that deploy Checkly. Grant the repository principal roles/iam.workloadIdentityUser on the service account, then grant that service account roles/secretmanager.secretAccessor only on the secrets listed in the workflow.
Add these non-secret values as GitHub Actions variables:
Scope secrets in your constructs
Read each value withsecret() and mark it as secret on the group or check that needs it:
__checks__/payments.check.ts
CHECKLY_SECRET_PAYMENTS_API_KEY and CHECKLY_SECRET_PAYMENTS_ADMIN_TOKEN when the project is loaded for deployment. If a required value is missing, secret() stops the deployment instead of deploying an empty value. Checkly then stores each value at the declared scope.
Fetch and deploy from GitHub Actions
The Google Secret Manager action returns masked step outputs. Map those outputs toCHECKLY_SECRET_* variables only on the deploy step:
Google maintains
get-secretmanager-secrets in the google-github-actions organization, but its README states that it is not an officially supported Google Cloud product and is not covered by a Google Cloud support contract..github/workflows/deploy-checkly.yml
id-token: write permission lets the job request a GitHub OIDC token. Google Cloud IAM still determines which secrets it can read.
Rotate a secret
The short secret names in the workflow fetch thelatest enabled version. After you add a new version in Google Secret Manager, run this deployment workflow again to update the encrypted value stored by Checkly. Rotation in Google Cloud alone does not update an already deployed Checkly secret.
When the workflow no longer needs a value, remove it from the construct, workflow mapping, and service account IAM policy.