Skip to content

Commit

Permalink
command/fmt: Make implicit provider requirements explicit
Browse files Browse the repository at this point in the history
Ever since Terraform v0.13 we've been recommending that module authors be
explicit about which providers their modules are intended to work with,
but we retained some heuristics for detecting undeclared dependencies on
official providers for backward compatibility with modules intended for
Terraform v0.12 and earlier.

In the intervening years we've found that those heuristics have caused a
lot of confusion, because Terraform tends not to be clear about what
guesses it is making but then returns confusing error messages that only
make sense if you are already an expert on Terraform's compatibility
heuristics. These have been some of the most frequently asked questions
about Terraform in community forums over the years.

In an attempt to make these rules easier to understand, "terraform fmt"
will now run the same heuristics and then generate explicit declarations
reflecting what it detected. This makes it explicit that it's good style
to declare your dependencies explicitly, and also gives new users a clearer
signal about what Terraform is guessing so that they have a better chance
of learning what they might need to change if Terraform's guesses were
not correct.
  • Loading branch information
apparentlymart committed Jun 26, 2024
1 parent af498dd commit 1c4f315
Show file tree
Hide file tree
Showing 3 changed files with 791 additions and 7 deletions.
Loading

0 comments on commit 1c4f315

Please sign in to comment.