You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When committing / changing our backend.tf.json file (which is a standard file in both tofu + terraform), both plugins are trying to run their fmt command against those files. This results in the following error:
trunk_cli_version: 1.22.8
title: terraform exited with exit_code=2
report:
- terraform exited with exit_code=2
- linter:
command: |
/<MY_USER_PATH>/.cache/trunk/tools/terraform/1.1.0-6bc9ed0aa441bfb0bf13ee36e04a2bde/terraform fmt -no-color -
stdin_path: |
/private/var/folders/7l/fp_bz3gx6yzg24hw08ww9vp00000gn/T/trunk-501/GlML4Y/root-modules/kms/backend.tf.json
run_from: /private/var/folders/7l/fp_bz3gx6yzg24hw08ww9vp00000gn/T/trunk-501/GlML4Y
timeout: 10m
rerun: (cd /private/var/folders/7l/fp_bz3gx6yzg24hw08ww9vp00000gn/T/trunk-501/GlML4Y; cat /private/var/folders/7l/fp_bz3gx6yzg24hw08ww9vp00000gn/T/trunk-501/GlML4Y/root-modules/kms/backend.tf.json | env -i PATH=/<MY_USER_PATH>/.cache/trunk/tools/terraform/1.1.0-6bc9ed0aa441bfb0bf13ee36e04a2bde:/<MY_USER_PATH>/.cache/trunk/tools/terraform/1.1.0-6bc9ed0aa441bfb0bf13ee36e04a2bde HOME=/<MY_USER_PATH> /<MY_USER_PATH>/.cache/trunk/tools/terraform/1.1.0-6bc9ed0aa441bfb0bf13ee36e04a2bde/terraform fmt -no-color -)
affects_cache:
[]
direct_configs:
[]
exit_status: exited
exit_code: 2
stdout: (none)
stderr: |
Error: Argument or block definition required
on <stdin> line 1:
1: {
An argument or block definition is required here.
parser: |
(none)
If you run terraform fmt against that file directly via terraform fmt -no-color backend.tf.json then you get the following:
Error: Only .tf, .tfvars, and .tftest.hcl files can be processed with terraform fmt
This goes to say that trunk should not be trying to run fmt against these ****.tf.json files and this now causing a false error.
We've been using these plugins for a while and this is the first that we're running into this. So we believe something must have changed upstream in trunk check itself?
Hi! Thanks for flagging this. I have a repro and confirm the issue. This file config has been the case in Trunk for as long as I can remember, and we haven't made any recent changes that would have affected this, so I'm not sure why this would suddenly crop up for you.
Regardless, I will raise a fix to handle this. In the meantime, you can always add an ignore for those .tf.json files.
Fixes#941. Verified repro
with terraform and tofu format on `x.tf.json` files. Did a bit of
research as well to make sure our other security scanners don't scan
`.tf.json` files, and we should be fine.
Info
When committing / changing our
backend.tf.json
file (which is a standard file in both tofu + terraform), both plugins are trying to run theirfmt
command against those files. This results in the following error:If you run
terraform fmt
against that file directly viaterraform fmt -no-color backend.tf.json
then you get the following:This goes to say that trunk should not be trying to run
fmt
against these****.tf.json
files and this now causing a false error.We've been using these plugins for a while and this is the first that we're running into this. So we believe something must have changed upstream in
trunk check
itself?trunk.yaml
The text was updated successfully, but these errors were encountered: