Publish your modules
Optional: hand this page to your coding agentThe steps work by hand too.Show the whole prompt
Read https://intentius.io/terragucci/guides/publish-modules/.
Add the `modules:` block, run `npx terragucci publish --dry-run`, show me what
would be published, run `npx terragucci init`, and open a pull request. List the
registry credentials I must add; do not add them. If I ask for attested
releases, add `attest: true` and tell me to run `cosign generate-key-pair`
myself; never create, read or commit a private key.
Never apply, approve (a pull request review or `terragucci approve`), override a policy denial (`terragucci override`), use `--mode apply`, or merge; never touch `.chant/allowed_signers` or `chant/lifecycle`.Result
Section titled “Result”Every module that changed on the default branch released under a new number, each with a digest your roots can pin.
Each level is opt-in:
| Level | Config | What it adds |
|---|---|---|
| Publish | modules.publish |
a git tag or OCI tag per release, pinned rollouts by pull request, and version bump jobs |
| Registry | modules.registry |
each release as a module registry’s files in a bucket or a Pages site, so roots call them by registry source and version |
| Test | modules.test: true |
tofu test or terraform test on each module before a release of it publishes |
| Attest | modules.attest: true as well |
a signature, SLSA provenance and an SBOM for each release, and a record of it in the release ledger |
Prerequisites
Section titled “Prerequisites”| You need | Why |
|---|---|
Modules in one place, such as modules/network and modules/service |
each directory there is published on its own |
| Conventional commit messages | they decide the version bump |
An OCI registry, or permission to push git tags to origin |
where the versions go; Terraform has no OCI sources, so its roots pin a git tag |
-
Name the modules and where they go in
terragucci.yml.modules:path: modules/*publish: oci://registry.example.com/acme/modulespublishtakes anoci://registry address,git-tags, or a list of both.Target Roots pin Credentials oci://registryOpenTofu roots, by ?tag=or?digest=, and Terragrunt 1.2 units interraform { source }(Use Terragrunt)the registry variables in step 4 git-tagsTerraform roots, by git tag none; the tags are pushed to origin -
Preview.
Terminal window npx terragucci publish --dry-runThe output lists each changed module and its next version under the version bump rules. For commits with no conventional type, see
respond.version-bump. -
Add the publish job.
Terminal window npx terragucci initThat adds a
publishjob, which runs with full history afterapplyon each push to the default branch. -
Give it registry credentials; no other job gets them.
Repository secrets.
Protected, masked CI/CD variables.
As on GitHub, repository secrets.
Variable Holds TERRAGUCCI_REGISTRY_USERthe registry user TERRAGUCCI_REGISTRY_PASSWORDits password or token TERRAGUCCI_REGISTRY_INSECURE1for a registry without TLS -
Merge a change to a module.
The next push to the default branch publishes, printing each version’s OCI manifest digest for a root to pin:
oci://registry.example.com/acme/modules/network?digest=sha256:..., or?tag=0.2.0for the tag.Each OCI version is an OpenTofu module package: an image manifest with the artifact type
application/vnd.opentofu.modulepkg, an empty config, and onearchive/ziplayer. The zip holds the module directory at its root, so//<dir>selects a directory inside it. The same files give the same zip and the same manifest digest.terragucci 0.4.40 and earlier pushed the layer as a gzipped tar, which
tofu initcannot install. The publish job finds those versions and pushes each one again under its tag as a zip of the same files, with the same commit and content. It prints one line for each:network 0.1.0: republished as archive/zip to oci://.... Undermodules.attest, the new manifest is signed and recorded like any release. A root that pins such a version by digest still names the tar, so pin the tag or the new digest.With
git-tags, each version is a tag on the repo,<module>/v<version>. Heremodules/servicemoved to0.2.0after a change whilemodules/queuestayed at0.1.0.A published version’s files never change, so a rerun publishes nothing. Git-tag publishing fetches
origin’s tags first; different content under an existing tag stops the run and names the tag.
Test each release
Section titled “Test each release”With modules.test, the publish job runs the binary’s test on each module before releasing it. A module with no test files or with failing tests is refused; the other modules still publish, and the job fails at the end.
binary: tofu
modules:
path: modules/*
publish: git-tags
test: trueThe test files are the binary’s own: *.tftest.hcl (and *.tofutest.hcl for OpenTofu) in the module or in its tests directory.
variables {
name = "dev"
}
run "names" {
command = plan
assert {
condition = terraform_data.net.input == "dev"
error_message = "the name is not passed through"
}
}The job runs init -backend=false and then test in the module’s directory. The forge token, signing key and registry credentials are withheld from it. A refused release says why, with the end of the binary’s output when a test failed:
network 1.1.0: refused, not published to git-tags (modules/network has no tests (no *.tftest.hcl in it or its tests directory), and modules.test publishes only a release whose tests pass)publish --dry-run runs no tests; it says which releases it would test.
Serve a module registry
Section titled “Serve a module registry”With modules.registry, a bucket or a Pages site also serves each release as static files in the module registry protocol. Roots call the modules by registry address, pinned to one version:
module "network" {
source = "modules.example.com/acme/network/generic"
version = "1.0.0"
name = "dev"
}-
Name the bucket, the address that serves it, and the namespace.
modules:path: modules/*publish: git-tags # optional; the registry can stand alonetest: trueregistry:bucket: s3://acme-modulesurl: https://modules.example.comnamespace: acmeSetting Default Holds urlrequired the https://address that serves the files, with no path. Terraform and OpenTofu look for a registry at its host’s root, over HTTPS only. Its host starts each module’s sourcenamespacerequired the namespace modules go under bucketordirone is required an s3://,gs://oraz://bucket, or a directory in the repo that a Pages site deploysprefixnone where the files go in the bucket; urlserves that prefix as its rootendpointnone an S3-compatible store’s address namespacesnone a tag prefix (a path in the repo, such as platform/) to the namespace its modules go under; the longest prefix winssystemgenericthe third part of each address downloadtarballwhat each version’s download points at: a .tar.gzbeside it, its git tag (git-tags, whichpublishmust list), or its OCI artifact (oci, whichpublishmust list; OpenTofu only)edgepicked from bucket,endpointordirwhat sends the X-Terraform-Getheader Terraform needs:cloudflare,cloudfront,pagesornone; see Put an edge function in front of the bucketauthofftokenhas the edge function refuse a read without a bearer token, and sign tarball URLsprovidersnone mirroralso serves the providers the lock files pin as a network mirror underproviders/; see Serve the providers from the registry tooA module’s address is
<host>/<namespace>/<name>/<system>, where the name is its directory’s name:modules/networkismodules.example.com/acme/network/generic. -
Give the publish job write access to the bucket.
Terminal window npx terragucci initThe publish job on GitHub and Forgejo maps the bucket’s key secrets as a job that keeps reports in a bucket does: for S3 the pair
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY, for AzureAZURE_STORAGE_KEY. GitLab passes it CI/CD variables of those names. -
Serve the bucket over HTTPS at
url, through the edge function for its host. Only the publish job writes the bucket. -
After the next module change merges, the publish job writes:
File Holds .well-known/terraform.jsonservice discovery: {"modules.v1": "/v1/modules/"}v1/modules/<namespace>/<name>/<system>/versionsevery published version v1/modules/<namespace>/<name>/<system>/<version>/download{"location": ...}, the tarball, git tag or OCI artifactv1/modules/<namespace>/<name>/<system>/<version>/<name>-<version>.tar.gzthe module, with download: tarballv1/modules/<namespace>/<name>/<system>/<version>/release.jsonthe commit and content digest the next publish compares against The stored download answer is a JSON body with
location. OpenTofu reads that body. Terraform reads only theX-Terraform-Getheader, which a bucket or a static site cannot send on its own, so Terraform installs only through the edge function or a_headersfile. A version is listed inversionsonly after the files it points at are written. -
Pin a root to the registry and run
init. It installs1.0.0, the version the root names. When a newer version publishes, a rollout (terragucci rollout modules/network) moves the pin in each root that calls it.
In a monorepo, each part’s modules can go under a namespace of their own. Tags are <path>/v<version>, so the path prefix of a module is its tag prefix:
registry:
bucket: s3://acme-modules
url: https://modules.example.com
namespace: acme
namespaces:
platform/: platform
data/: dataplatform/modules/network is modules.example.com/platform/network/generic. Two modules at one address stop the publish and name both.
With dir, the publish job writes the files into that directory of its checkout, beside what is there. You deploy the directory to the Pages site and keep the earlier versions in it (from the site’s branch, for example), since versions lists only what the directory holds.
A rollout of modules/network moves the version of each call to its registry address. A call pinned by a constraint such as ~> 1.0 has no one version to move, and the rollout refuses it.
Put an edge function in front of the bucket
Section titled “Put an edge function in front of the bucket”Terraform finds a version’s location in the X-Terraform-Get header of the download answer and fails without it:
Error: Error accessing remote module registry
Failed to retrieve a download URL for modules.example.com/acme/network/generic
1.0.0 from modules.example.com: failed to get download URL for
"modules.example.com/acme/network/generic": 200 OKAn edge function on your CDN reads the stored answer and sends the same location in the header, keeping the JSON body, so both binaries install. terragucci picks the function from where the files are, and edge overrides the pick:
| Files in | edge |
Sends the header with |
|---|---|---|
an R2 bucket (endpoint on r2.cloudflarestorage.com), a gs:// or an az:// bucket |
cloudflare |
a Cloudflare Worker |
any other s3:// bucket |
cloudfront |
a Lambda@Edge function on CloudFront; a CloudFront Function cannot read the stored answer |
dir, deployed to Cloudflare Pages or Netlify |
pages |
a _headers file the publish job writes beside the files, one rule per version |
dir on GitHub Pages or GitLab Pages, or a plain bucket website |
none |
nothing: OpenTofu installs, Terraform does not |
Cloudflare Pages reads at most 100 rules from _headers. Past that, the publish job says so on each new version; serve the files through edge: cloudflare or from Netlify.
-
Write the function and its deploy config.
Terminal window npx terragucci registry edgeIt writes
registry-edge/and prints the steps for your CDN. Forcloudflare, the directory holdsworker.mjsand awrangler.tomlthat binds the R2 bucket, or names the bucket’s address inREGISTRY_ORIGIN, and routesurl’s host to the Worker. Forcloudfront, it holdsindex.mjsandregistry-edge.json, which you zip into one Lambda function in us-east-1 on Node.js 20 or later. -
Deploy it.
Terminal window cd registry-edgenpx wrangler deployPublish a version of the function and attach it to the distribution’s default behavior as an origin-request trigger. Give that behavior an origin request policy that passes the
Authorizationheader and every query string to the origin. -
Run
initin a root that calls a module from the registry. Both binaries install.
Require a token to read
Section titled “Require a token to read”With auth: token, the function refuses discovery, versions, download and every other file without Authorization: Bearer <token>, answering 401. A tarball’s download answer becomes a signed URL that opens that one file for five minutes, so the archive fetch needs no token of its own. Git and OCI locations go out as stored, and their own access rules apply.
modules:
registry:
bucket: s3://acme-modules
url: https://modules.example.com
namespace: acme
auth: tokenauth: token needs edge: cloudflare or edge: cloudfront; a _headers file cannot check a token.
-
Make a token and keep it in your secret manager.
Terminal window openssl rand -hex 32 -
Give it to the function.
Terminal window npx wrangler secret put REGISTRY_TOKENSThe Worker reads its tokens from that secret, one per line or comma separated.
Lambda@Edge has no environment variables, so the function gets its tokens from the zip or from a store it reads at run time.
modules.registry.tokenspicks one:tokensTokens live in Rotation zip(default)registry-edge.json, written byterragucci registry edgewrite the function again and deploy a new version ssman SSM Parameter Store parameter, tokens_namechange the parameter; every replica reads it within five minutes secrets-managera Secrets Manager secret, tokens_namechange the secret; every replica reads it within five minutes With
zip, the token goes intoregistry-edge.jsonwhen you write the function:Terminal window TERRAGUCCI_REGISTRY_TOKENS=<token> npx terragucci registry edgeKeep
registry-edge/out of git, and deploy the new version.With a store, the file names the store and holds no token, so the directory can be committed:
modules:registry:bucket: s3://acme-modulesurl: https://modules.example.comnamespace: acmeedge: cloudfrontauth: tokentokens: ssmtokens_name: /registry/tokenstokens_region: us-east-1Terminal window aws ssm put-parameter --region us-east-1 --name /registry/tokens --type SecureString --value "<token>"npx terragucci registry edgeFor
secrets-manager, settokens: secrets-managerand put the secret’s name or ARN intokens_name.tokens_regionis where the store is read from and defaults tous-east-1, where Lambda@Edge functions are created; the replica’s own region is never used.The value is the tokens, one per line or comma separated. A JSON value,
{ "tokens": ["..."], "signingKey": "..." }, also sets the key that signs tarball URLs.The function’s execution role needs read access to the store:
tokensPermission ssmssm:GetParameteron the parameter, andkms:Decrypton the key when the SecureString uses a customer-managed keysecrets-managersecretsmanager:GetSecretValueon the secret, andkms:Decrypton the key when the secret uses a customer-managed keyIf the store cannot be read, or holds no token, every request gets a 503 and nothing reaches the bucket. The function never serves an old token past the five minutes.
-
Give each reader the token. Both binaries send it for the registry’s host from
TF_TOKEN_modules_example_com, or from acredentials "modules.example.com"block in the CLI config orcredentials.tfrc.json. Thetf-checkand rollout jobs read a registry the same way, so give them the variable too.
To rotate a token, give the function both tokens, <old>,<new>, and deploy. Move every reader to the new token, then give the function the new one alone and deploy again. The tarball URLs are signed with the first token, so a URL handed out before the swap stops working; each one lasts five minutes.
OpenTofu 1.12 and later also read "use_registry_credentials": true in a download answer’s body. OpenTofu then fetches the location itself and sends the registry host’s token with it, which fits a server that keeps tarballs behind the same token check without signed URLs. Terraform has no such field, and terragucci’s files do not set it.
Other ways to keep a registry private
Section titled “Other ways to keep a registry private”A registry on a private network needs no function for the token: serve it only inside a VPN or behind an IP allowlist or Cloudflare Access, and use auth: off. Terraform still needs the header, so keep the edge function or _headers file for it.
A team that already runs GitLab, HCP Terraform, Artifactory or Nexus can publish its modules there and read them with that registry’s own credentials.
Publish to GitLab’s module registry
Section titled “Publish to GitLab’s module registry”A GitLab project’s Terraform module registry can take each release too:
modules:
publish:
- git-tags
- gitlab://gitlab.example.com/platform/modulesIn GitLab CI, publish: gitlab names the job’s own project and uploads with its CI_JOB_TOKEN. Elsewhere, write the project’s address and put a token with the api scope in GITLAB_TOKEN. On GitHub and Forgejo the publish job reads it from the secret modules.gitlab_token names, GITLAB_TOKEN unless set.
The upload is the archive the bucket registry serves and the attestation signs, so every target has one digest. Publish reads the release back as Terraform would before it reports it. A release already there with the same content is left alone, and one with other content is refused. The host keeps no commit for what it holds, so publish takes the commit from the release record on the ledger. Without a record, as for an upload by hand, the commit comes from the git-tags tag; with neither, publish stops and says what to fetch.
Roots call the module under the project’s top-level group:
module "network" {
source = "gitlab.example.com/platform/network/generic"
version = "1.3.0"
}The system is modules.registry.system when the repo also serves a bucket registry, else generic. To read a private project, Terraform and OpenTofu take TF_TOKEN_gitlab_example_com with the read_api scope, or a credentials block. GitLab has no deprecated flag, so a deprecation shows only in the bucket’s catalog and in the tip.
Publish to HCP Terraform
Section titled “Publish to HCP Terraform”HCP Terraform’s private registry takes releases through its API, on every tier and with no VCS connection:
modules:
publish:
- git-tags
- hcp://acme # or hcp://tfe.example.com/acme for Terraform EnterpriseThe publish job reads its token from TFE_TOKEN, else from TF_TOKEN_app_terraform_io or a credentials block for the host. The token’s team needs the Manage modules permission. A 404 from HCP means the team lacks it or the organization has no private registry, and the publish error says both.
Publish creates the module when HCP lacks it and then the version with its commit, and uploads the same archive as the other targets. It waits for HCP to finish reading the archive, and a release still being read when the wait ends is reported without failing. A 429 is retried after Retry-After. Roots call app.terraform.io/acme/network/generic, with the system from modules.registry.system when it is set. HCP has no deprecated flag either.
Publish to Artifactory or Nexus
Section titled “Publish to Artifactory or Nexus”A JFrog Artifactory local Terraform repository and a Sonatype Nexus hosted Terraform repository (Nexus 3.89 and later) take releases too:
modules:
publish:
- artifactory://acme.jfrog.io/terraform-local
- nexus://nexus.example.com/terraform-hosted/platformEach uploads the zip of the attested archive with basic credentials: JFROG_USER and JFROG_ACCESS_TOKEN for Artifactory, NEXUS_USER and NEXUS_TOKEN for Nexus. The last part of the address is the namespace; left out, it is modules.registry‘s for each module. Artifactory sources join the repository and namespace with __, as in acme.jfrog.io/terraform-local__acme/network/generic. A Nexus source starts with the label of the readers’ CLI host block, the repository’s name in lower case, as in terraform-hosted/platform/network/generic. Sonatype’s docs disagree on whether a hosted repository needs a signing key for modules, so set one when you create it.
Point the binaries at the registry by CLI config
Section titled “Point the binaries at the registry by CLI config”A host block in the CLI config sends a host’s module requests to another address, with no service discovery. It suits CI images and machines you set up, such as a registry reached at an internal name:
host "modules.example.com" {
services = {
"modules.v1" = "https://modules.internal.example.com/v1/modules/"
}
}Terraform reads the block from TF_CLI_CONFIG_FILE or ~/.terraformrc, OpenTofu from TF_CLI_CONFIG_FILE or ~/.tofurc. A source with no host resolves to registry.terraform.io under Terraform and registry.opentofu.org under OpenTofu, so a block for one of them does nothing for the other binary. The address it names needs a certificate the binary already trusts.
Serve the providers from the registry too
Section titled “Serve the providers from the registry too”With providers: mirror, the publish job also serves every provider the repo’s lock files pin as a provider network mirror, under providers/ beside the modules:
modules:
registry:
bucket: s3://acme-modules
url: https://modules.example.com
namespace: acme
providers: mirrorAfter the modules publish, the job runs the binary’s providers mirror once for each distinct lock file, with each provider at exactly its locked version, so the lock file’s hashes check every download. The mirror is for linux_amd64. Each provider locked on registry.terraform.io or registry.opentofu.org is mirrored under the other host as well, so a source with no host resolves under both binaries. Archives go up first and each index.json last, so a reader never sees a version whose files are not there yet. A publish whose lock files pin nothing new mirrors nothing again.
The job’s output ends with the block each reader adds to its CLI config:
provider_installation {
network_mirror {
url = "https://modules.example.com/providers/"
include = [
"registry.opentofu.org/hashicorp/aws",
"registry.terraform.io/hashicorp/aws",
]
}
direct {
exclude = [
"registry.opentofu.org/hashicorp/aws",
"registry.terraform.io/hashicorp/aws",
]
}
}include and exclude name the same providers. A mirrored provider then comes only from the mirror, and any other provider comes straight from its registry. With auth: token the index and version files need the token. The edge function signs each archive URL in the version files, as it signs tarballs.
Browse the release catalog
Section titled “Browse the release catalog”A registry with modules.registry also gets a release catalog under catalog/ beside its files. Its index.html has a search box over index.json and links to a page for each module and each version; each module also gets a consumers.json. Every publish records its release on chant/lifecycle with its version, attested or not, and the catalog is built from those records and the deprecations beside them. The registry’s own versions files are never read for it.
A version’s page shows its inputs, outputs, required providers, examples and README, read from the module at the commit the version was cut from. A module with a .terraform-docs.yml gets the markdown terraform-docs writes with that file instead, when terraform-docs is on the job’s PATH; it runs on a scratch copy and prints to stdout, so the module’s README in the repo is never rewritten. The changelog groups the conventional commits since the previous version. Under it sit the attestation with the command that checks it and the roots in this repo that pin the version.
Across a control repo, each project keeps a consumers.json at its top: terragucci modules consumers writes it from the project’s roots, and --check fails when it no longer matches them. A repo with control runs --check in its check job, so a pull request that changes a pin also updates the file. A publishing repo with control reads the control repo’s projects and each one’s consumers.json, with TERRAGUCCI_CONTROL_READ_TOKEN, and the catalog lists every project’s roots on each version. Without the token it lists this repo’s roots only.
A version keeps the page it was first written with, and a file already in the bucket with the same bytes is left alone, so a rerun that publishes nothing writes nothing. terragucci publish --dry-run writes no catalog. To turn the catalog off:
modules:
registry:
bucket: s3://acme-modules
url: https://modules.example.com
namespace: acme
catalog: offterragucci modules lists the catalog from the command line, and terragucci modules show <module> lists one module’s versions with their status and consumers:
terragucci modules
terragucci modules show modules/network
terragucci modules --registry https://modules.example.com --jsonIt reads catalog/index.json the way Terraform reads the registry, with TF_TOKEN_<host> or a credentials block, so it works against a registry with auth: token. A browser sends no token, so the edge function refuses the catalog’s pages to it; to browse them, serve the registry on a private network as in Other ways to keep a registry private, where the pages open with no token.
Deprecate or yank a version
Section titled “Deprecate or yank a version”Anyone who can publish marks a version on the release ledger:
terragucci modules deprecate modules/network 1.2.0 --reason "drops the old subnet layout" --use 1.3.0
terragucci modules yank modules/network 1.1.0 --reason "opens the admin port" --use 1.3.0
terragucci modules restore modules/network 1.1.0Each pushes one status record beside the release record. The record keeps who set it and when, with the reason and the --use version. The catalog is then written again, so the mark reaches roots in other repos. A root that pins a deprecated version gets the terragucci-deprecated-version tip on its plan and still passes. A yanked version is refused by modules.require: attested, naming the version to move to. Both stay in the registry’s versions, so an existing pin still runs init. restore clears either mark with one more record; the earlier ones stay in the ledger’s history.
Attest each release
Section titled “Attest each release”With modules.attest, the publish job also signs each new release with a key you hold and records the version in the release ledger on chant/lifecycle, so a root’s pin can be checked against all of it.
-
Make a cosign key pair, and commit the public half.
Terminal window cosign generate-key-pairgit add cosign.pubKeep
cosign.keyout of the repo. Signing never writes to Sigstore’s public transparency log. -
Add two more secrets, the same way as the registry credentials in step 4.
Variable Holds COSIGN_PRIVATE_KEYthe contents of cosign.keyCOSIGN_PASSWORDits password -
Turn it on, and write the pipeline again.
modules:path: modules/*publish: git-tagsattest: true # or attest: { key: keys/modules.pub }Terminal window npx terragucci initThe publish job now installs cosign, checked against its release checksums, before it publishes.
-
After a module change merges, check what was released.
Terminal window npx terragucci verify-release modules/service 0.2.0It reads the tag as it stands now and prints
verifiedfor each target, orrefusedand why.
terragucci runs each version through these phases from this config, with no file of your own:
| Phase | Does |
|---|---|
| Archive | takes the bytes the tag names: the module archive for a git tag, the manifest for an OCI tag |
| Sbom | writes SPDX 2.3 JSON from the module’s HCL: each provider in required_providers, at its lock file’s version when there is one, and each module it calls from another source |
| Sign | signs the bytes with cosign |
| Provenance | attests SLSA v1 provenance naming the commit and the run |
| SbomAttestation | attests the SBOM |
| Verify | checks all three against cosign.pub; a job given the wrong key stops here, before it writes anything |
| Record | makes the release record: the module’s path, the digest of those bytes, the commit, the run and the actor |
| What | Where |
|---|---|
| The release record | a line of modules/releases.jsonl on chant/lifecycle |
| The bundles and the SBOM | modules/attest/<digest>/ beside it |
| An OCI tag’s signature and attestations | attached to its manifest |
| A git tag and its record | pushed together in one atomic push; an OCI tag is pushed only after its record |
A tag pushed by hand has no record that matches it, and neither does one moved after its release; verify-release refuses both. To go back to an earlier version, roll out that version again.
Require attested releases
Section titled “Require attested releases”With modules.require: attested, tf-check and tf-plan check each module pin a root makes before they plan it. A root pinning a release that does not verify fails. So does one pinning a release its publisher yanked, whose refusal names the version to move to. The check report and plan note name its module call and version and say why.
In a Terragrunt repo the pin is each unit’s terraform { source }, and for a unit an explicit stack generates from a remote source, its unit block’s source in terragrunt.stack.hcl. An oci:// source that picks a directory with // is checked as the release of the whole package. tf-check runs terragucci check-pins over every unit, and tf-plan takes a refused unit out of its wave, so it fails without planning while the rest of the wave plans.
modules:
publish: git-tags
attest: true
require: attestedOnly these sources are checked; a module from anywhere else, such as the public registry, is left alone:
| Source | Checked when | Key | Ledger |
|---|---|---|---|
| This repo’s own modules | modules.attest is on: the repo’s git URL for git-tags, each oci:// target, and the host of modules.registry |
modules.attest.key |
chant/lifecycle on origin |
| A publisher in another repo | modules.trusted lists it |
its key |
its ledger |
modules:
require: attested
trusted:
- source: git::https://git.example.com/platform/modules.git
key: keys/platform-modules.pub
ledger: https://git.example.com/platform/modules.gitTo trust a publisher, commit their cosign.pub at the path key names. For each pin of a checked source:
| Check | Refused when |
|---|---|
| The pin | it names no one release: a git ref that is not a tag, an oci:// source with no tag or digest, a registry source whose version is a constraint |
| The record | the publisher’s ledger has no record of the bytes the tag names now, from the tag’s commit: a tag pushed by hand, moved, or never published |
| The signature, provenance and SBOM | any of them is missing or does not verify against the key |
| The OCI artifact | its manifest has no archive/zip layer, so tofu init cannot install it |
| Job | Reads the setting and the keys from |
|---|---|
tf-plan |
the base branch, as it reads the policy, so a pull request cannot turn the check off or trust a key of its own |
tf-check |
the base branch when its checkout has it, else the checkout |
A registry source is checked where its registry says the version is: the tarball’s bytes, or the git tag or OCI artifact its download points at, each checked as that kind of source is. Under download: tarball a release is signed and recorded in the ledger before versions lists it. The jobs read the registry over HTTPS, as tofu init does, so a private CA’s certificate goes in NODE_EXTRA_CA_CERTS.
Tags and the ledger are fetched with the jobs’ own git access; an oci:// source is read with no login, or with TERRAGUCCI_REGISTRY_USER and TERRAGUCCI_REGISTRY_PASSWORD when the job has them.
- Supply chain: where everything a job runs comes from, and what is checked before it runs.
- Roll out a new module version moves your roots onto it.
- Environment variables and credentials
terragucciHelp setting it up: Intentius
These docs count page views and clicks with PostHog. They set no cookies, store nothing in your browser, and send nothing when your browser asks not to be tracked.