Prerequisites
Prerequisites
- A Checkly Monitoring as Code project with its dependencies and lockfile committed.
- A GitHub repository with Actions enabled and a protected environment named
checkly-production. - A Vault server reachable from the GitHub Actions runner, with the required values stored in a KV secrets engine.
- Permission to configure a Vault JWT auth method, policy, and role.
VAULT_ADDRandCHECKLY_ACCOUNT_IDconfigured as GitHub Actions variables.- The Checkly API key stored in Vault alongside the secrets required by this CLI project.
This guide uses a fictional payments service; replace its names, paths, and
URL with your own application values. Checkly requires
CHECKLY_API_KEY and
CHECKLY_ACCOUNT_ID; VAULT_ADDR configures this workflow.Configure Vault access
Configure Vault’s JWT authentication for GitHub Actions and create a role for this deployment by following HashiCorp’svault-action JWT guide. The workflow below assumes that role is named checkly-payments-deploy.
Restrict the role to the repository, branch, and GitHub environment that deploy Checkly. Its policy should grant read-only access only to the Vault paths referenced by this project. The role’s audience must match jwtGithubAudience in the workflow. See HashiCorp’s JWT role reference for the Vault configuration options.
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 CLI loads the project. If a required value is missing, secret() stops the deployment instead of deploying an empty value.
Fetch and deploy from GitHub Actions
The official HashiCorp action authenticates with GitHub’s OIDC token and returns masked step outputs. SetexportEnv: false, then map the outputs to CHECKLY_SECRET_* variables only on the deploy step:
.github/workflows/deploy-checkly.yml
id-token: write to request the GitHub OIDC token and contents: read for checkout. The Vault role and policy determine which values the job can read.
Rotate a secret
Rotating a value in Vault does not automatically update the encrypted copy stored by Checkly. Run this trusted deployment workflow again after rotation. The action reads the current KV value andcheckly deploy updates the secret at its declared group or check scope.
When the workflow no longer needs a value, remove it from the construct, workflow mapping, and Vault policy or path.