Show all warnings?

If you want to display this a little nicer than raw JSON …

terraform validate -json | jq -r '[ del( .diagnostics[] | select( .detail | startswith( "Experimental features" ) ) ) | .diagnostics[] | { Detail:.detail, Address:.address, Filename:.range.filename, Line:.range.start.line } ] | ( .[0] | keys_unsorted | ( . , map( length*"-" ) ) ), .[] | map(.) | @tsv' | column -ts $'\t'

which will produce something like:

Detail                                                          Address                                     Filename                  Line
------                                                          -------                                     --------                  ----
Use the aws_s3_bucket_acl resource instead                      module.efs_backup.aws_s3_bucket.efs_backup  modules/efs_backup/s3.tf  4
Use the aws_s3_bucket_lifecycle_configuration resource instead  module.efs_backup.aws_s3_bucket.efs_backup  modules/efs_backup/s3.tf  1
Use the aws_s3_bucket_acl resource instead                      aws_s3_bucket.config_recorder_bucket        aws-config.tf             191

[EDIT: The above will require jq v1.6]

4 Likes