Terramate "generated code is outdated" (generate drift) in CI
Terramate generates Terraform (backend, provider, and other blocks) from its config. A CI check runs terramate generate --detailed-exit-code (or --check) and fails when the committed generated files drift from what the current config would produce.
What this error means
A Terramate CI step fails reporting that generated code is outdated, or that generation produced changes, meaning the committed files were not regenerated after a config change.
error: generated code is outdated
please run 'terramate generate' and commit the changesCommon causes
Config changed without regenerating
A generate_hcl/generate_file block or its inputs changed, but the generated Terraform was not re-run and committed.
Generated files edited by hand
Someone edited a generated file directly; Terramate would overwrite it, so the check flags the drift.
How to fix it
Regenerate and commit
- Run
terramate generatelocally. - Commit the regenerated files.
- Push so the CI check passes.
terramate generate
git add . && git commit -m "regenerate terramate code"Gate generation in CI
Keep the check so drift fails fast and the regenerate lands with the config change.
terramate generate --detailed-exit-codeHow to prevent it
- Run
terramate generatewhenever generate blocks or inputs change. - Never hand-edit generated files.
- Keep the generate check in CI so drift is caught in review.