terraform providers Command Reference
See your provider dependency tree and lock it for every CI platform.
terraform providers prints the providers required across your configuration and modules. Its lock subcommand writes provider checksums for the platforms your CI runs on.
What it does
terraform providers displays a tree of provider requirements per module. terraform providers lock populates .terraform.lock.hcl with checksums for one or more target platforms so the same lock file verifies on macOS dev machines and Linux CI alike.
Common flags and usage
- (none): print the provider requirement tree
- lock -platform=...: record checksums for the given platforms
- schema -json: output full provider schemas
- mirror DIR: mirror providers to a local directory
Example
# Lock checksums for both the team and CI platforms
terraform providers lock \
-platform=linux_amd64 \
-platform=darwin_arm64In CI
Generate the lock for every platform your team and runners use, then commit .terraform.lock.hcl. This prevents the inconsistent dependency lock file failure that appears when a lock recorded only on macOS is verified on a Linux runner.
Key takeaways
- providers prints the per-module provider requirement tree.
- providers lock -platform records cross-platform checksums for the lock file.
- Commit a multi-platform lock so init is reproducible across all runners.