Skip to content

fix(tf): Add disable_upstream: true to validate command - #1183

Open
chris3ware wants to merge 1 commit into
trunk-io:mainfrom
chris3ware:fix/tf-validate
Open

chris3ware wants to merge 1 commit into
trunk-io:mainfrom
chris3ware:fix/tf-validate

Conversation

@chris3ware

Copy link
Copy Markdown
Contributor

Summary

Set disable_upstream: true on the validate command of the tofu and terraform linters.

Problem

Comparing against the upstream file version when module sources change produces an error:

{
    "severity": "error",
    "summary": "Module source has changed",
    "detail": "The source address was changed from \"git::https://github.com/terraform-aws-modules/terraform-aws-notify-slack.git?ref=a7765ac0a547f95c8aa48459f84077be8562c0f7\" to \"git::https://github.com/terraform-aws-modules/terraform-aws-notify-slack.git?ref=d81ac4e19dc0ace70204c70e4acd5dc3feb0b223\" since this module was installed. Run \"tofu init\" to install all modules required by this configuration.",
    ...
}

Fix

Set disable_upstream: true on validate because an upstream comparison is unnecessary for a command that depends on the locally initialised state.

Testing

Reproduced with a PR that changes a module source ref, with .terraform initialised on the PR branch:

  • Before: trunk check --filter=tofu --upstream=<base> fails with "Module source has changed".
  • After: the same command reports no issues.

@trunk-io

trunk-io Bot commented Oct 2, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant