Show all warnings?

When upgrading to the newest provider or Terraform version, I often need to correct my configs to use the new syntax and change deprecated features. Examples:

  1. Interpolation-only expressions are deprecated in 0.12
  2. The aws_lb_listener_rule in the AWS provider was updated to allow for a different (and better! thank you!) way of specifying conditions.

When I change my Terraform projects to use a new version of the provider or Terraform itself, it would be really helpful to see all warnings, even if there are dozens of them, so that I can correct them quickly. Right now, I have to run terraform plan, read 1 warning along with “(and 9 more similar warnings elsewhere)”, fix it, then run terraform plan again, read the warning with “(and 8 more similar warnings elsewhere)”, repeat until all warnings are resolved. Is there a better way?

Is there a way to have Terraform output all warnings rather than fix “(and 9 more similar warnings elsewhere)” until there are no warnings left? Like -verbose-warnings or something similar?

I haven’t used this - and so don’t know if this could be the solution for your question - but maybe this could help: https://www.terraform.io/docs/internals/debugging.html

Hi @johnstanfield,

There isn’t an explicit way to turn off the “similar warnings elsewhere” truncation, but as a workaround I believe you can force Terraform to show all of the warnings by introducing at least one validation error too. Terraform should show the warnings in full if they are accompanied by at least one error.

It will need to be an error that doesn’t prevent Terraform from processing the parts of the file that the warnings apply to, of course… one idea would be to add an invalid extra argument to one of your resource blocks so that it will fail validation, which shouldn’t block any of the warnings because resource validation happens after initial configuration parsing.


For the “interpolation-only expressions” warning, if you are comfortable working with a Go codebase yourself you might be interested in my side-project tool terraform-clean-syntax, which can take care of most examples of that warning automatically. It has some quirks/bugs because I threw it together quickly, but it should either produce a valid result or change nothing at all. You can use git diff to review what it did and make sure it all looks reasonable.

In case you still need this, the validate command has a JSON output option. This can be piped to jq to get the complete list of validation warnings.

A simple case might be:

terraform validate -json | jq ‘.diagnotics.range | “(.filename):(.start.line)”’

That will show you the filename and line number of all the locations where terraform things the code isn’t valid.