Skip to content

fix: skip terraform validate on sub-modules without .terraform.lock.hcl#2741

Draft
noahd1 wants to merge 5 commits intomainfrom
claude/fix-issue-2740-2aA93
Draft

fix: skip terraform validate on sub-modules without .terraform.lock.hcl#2741
noahd1 wants to merge 5 commits intomainfrom
claude/fix-issue-2740-2aA93

Conversation

@noahd1
Copy link
Copy Markdown
Member

@noahd1 noahd1 commented Mar 27, 2026

Summary

  • Changes the terraform lint driver target from parent to parent_with with path .terraform.lock.hcl, so terraform validate only runs on root module directories where terraform init has been executed
  • Sub-module directories (which lack .terraform.lock.hcl) are now skipped for validation, eliminating false positive "Missing required provider" and "Module not installed" errors
  • terraform fmt is unaffected and continues to work on all .tf files including sub-modules

Test plan

  • Verify terraform validate runs correctly on root module directories (those with .terraform.lock.hcl)
  • Verify sub-module directories without .terraform.lock.hcl are skipped for validation
  • Verify terraform fmt still applies to all .tf files including sub-modules
  • Run existing test suite to confirm no regressions

Closes #2740

https://claude.ai/code/session_016dWLoazBkTb9wWejVwJSKW

Change the terraform lint driver target from "parent" to "parent_with"
with path ".terraform.lock.hcl" so that `terraform validate` only runs
on root module directories where `terraform init` has been executed.
Sub-module directories are skipped, preventing false positive "Missing
required provider" and "Module not installed" errors.

Closes #2740

https://claude.ai/code/session_016dWLoazBkTb9wWejVwJSKW
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@qltysh
Copy link
Copy Markdown
Contributor

qltysh bot commented Mar 27, 2026

Qlty

Coverage Impact - ubuntu-latest

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@qltysh
Copy link
Copy Markdown
Contributor

qltysh bot commented Mar 27, 2026

Qlty

Coverage Impact - macos-15

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@qltysh
Copy link
Copy Markdown
Contributor

qltysh bot commented Mar 27, 2026

All good ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terraform plugin runs validate on sub-modules, causing false positives

3 participants