tofu-validate¶
tofu init -backend=false && tofu validate walked across every directory
named in validate_paths — root modules, sub-modules, and examples alike.
terraform-aws-bootstrap: ". modules/* examples/*"
terraform-aws-security-baseline: ". modules/* examples/*"
infra: "bootstrap src"
Carries two persistent caches: the OpenTofu provider plugin cache
(TF_PLUGIN_CACHE_DIR) so providers aren't re-downloaded per run, and a
resolved-modules cache (.terraform/modules/) so tofu init skips the
network on warm runs — masking transient upstream-registry outages that
would otherwise fail validate. See
Explanation: OpenTofu state and caching.
Jobs¶
| Job | What it runs |
|---|---|
tofu-validate |
Per matching path: tofu init -backend=false -input=false -no-color && tofu validate -no-color. Skips a path with no .tf files; non-zero overall exit if any path fails. |
Inputs¶
| Input | Type | Default | Description |
|---|---|---|---|
image_version |
string | "v0.3.0" |
infra-tools image tag. |
stage |
string | test |
GitLab CI stage. |
validate_paths |
string | "." |
Space-separated globs to walk. Each match becomes its own init+validate. |
changes |
array | ["**/*.tf", "**/*.tfvars", "**/*.tf.json", "**/.tflint.hcl", "**/.terraform.lock.hcl", ".gitlab-ci.yml"] |
Change-detection paths. Set ["**/*"] to always run. |
Usage¶
include:
- component: gitlab.com/phpboyscout/cicd/[email protected]
inputs:
validate_paths: ". modules/* examples/*"