Lock Terraform providers during init - #2144
Open
lucacavallaro wants to merge 5 commits into
Open
Conversation
Ensure provider lockfiles contain checksums for every supported platform and frozen initialization detects drift without modifying the checkout. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The reviewed changes have no unresolved approval-blocking issues.
Pull request overview
Adds multi-platform Terraform provider locking to initialization with frozen-mode drift detection and restoration.
Changes:
- Locks providers for four supported platforms.
- Restores frozen lockfiles on drift or failure.
- Updates tests, documentation, generated bundles, and release plans.
File summaries
| File | Description |
|---|---|
packages/nx-terraform-plugin/src/executors/init/schema.json |
Documents provider-lock behavior. |
packages/nx-terraform-plugin/README.md |
Explains normal and frozen initialization. |
packages/nx-terraform-plugin/dist/executors/plan/plan.js |
References the rebuilt dispatcher. |
packages/nx-terraform-plugin/dist/executors/init/init.js |
References the rebuilt dispatcher. |
packages/nx-terraform-plugin/dist/default-dispatcher-DhKv9MFb.js |
Rebuilds the bundled task implementation. |
packages/dx-tasks/src/terraform/init.ts |
Implements provider locking and frozen restoration. |
packages/dx-tasks/src/terraform/__tests__/init.test.ts |
Tests ordering, failures, drift, and restoration. |
.nx/version-plans/version-plan-1788444775645.md |
Plans patch releases for affected packages. |
Review details
- Files reviewed: 5/8 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
gunzip
approved these changes
Sep 3, 2026
Rely on Terraform's native lockfile validation in CI while retaining multi-platform provider lock generation for developer initialization. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep Terraform initialization focused after provider lock validation was delegated back to Terraform in CI. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep coverage for format-2 module lock drift while asserting that frozen initialization uses Terraform's read-only provider lock mode. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
krusty93
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Terraform initialization could leave
.terraform.lock.hclwith checksums for only the current platform, requiring the pre-commit hook to repair it later. Developer initialization should produce the repository's supported platform locks directly for the selected module.What changed
terraform providers lockfor Windows AMD64, macOS AMD64/ARM64, and Linux AMD64 in only the selected Terraform module.tfmodules.lock.jsonvalidation.Validation
pnpm nx run-many -t build test lint typecheck -p @pagopa/dx-tasks @pagopa/nx-terraform-plugin --skipNxCache