cli icon indicating copy to clipboard operation
cli copied to clipboard

ERROR: plan.out.json is not a file.

Open davidjeddy opened this issue 11 months ago • 1 comments
trafficstars

Description

Unexpected error is not a file when executing using the container image

To Reproduce

$ cat /etc/*release
Fedora release 40 (Forty)
NAME="Fedora Linux"
VERSION="40 (Workstation Edition)"
ID=fedora
VERSION_ID=40
VERSION_CODENAME=""
PLATFORM_ID="platform:f40"
PRETTY_NAME="Fedora Linux 40 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:40"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f40/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=40
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=40
SUPPORT_END=2025-05-13
VARIANT="Workstation Edition"
VARIANT_ID=workstation
Fedora release 40 (Forty)
Fedora release 40 (Forty)
$ terraform-compliance --version
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
terraform-compliance v1.3.48 initiated

1.3.48
$ tail ~/.toolchainrc 
export XDG_RUNTIME_DIR=/run/user/1000
if [[ ":$PATH:" != *":/home/david/.local/bin:"* ]]; then export PATH="/home/david/.local/bin:$PATH"; fi
source ~/.asdf/asdf.sh
source ~/.asdf/completions/asdf.bash
if [[ ":$PATH:" != *":/home/david/.tfenv/bin:"* ]]; then export PATH="/home/david/.tfenv/bin:$PATH"; fi
if [[ ":$PATH:" != *":/home/david/.tgenv/bin:"* ]]; then export PATH="/home/david/.tgenv/bin:$PATH"; fi
if [[ ":$PATH:" != *":/home/david/.tofuenv/bin:"* ]]; then export PATH="/home/david/.tofuenv/bin:$PATH"; fi
if [[ ":$PATH:" != *":/home/david/.kics/bin:"* ]]; then export PATH="/home/david/.kics/bin:$PATH"; fi
if [[ ":$PATH:" != *":/home/david/.xeol/bin:"* ]]; then export PATH="/home/david/.xeol/bin:$PATH"; fi
function terraform-compliance() { podman run --rm -v "$(pwd)":/target -i -t eerkunt/terraform-compliance:1.3.48 "$@"; }
$ terraform plan -out=plan.out
terraform show -json plan.out > plan.out.json

...

Saved the plan to: plan.out

To perform exactly these actions, run the following command to apply:
terraform apply "plan.out
$ terraform show -json plan.out > plan.out.json
$ ls -la
total 14248
drwxr-xr-x. 1 david david     378 Nov 28 15:00 .
drwxr-xr-x. 1 david david       8 Nov 14 11:45 ..
-rw-r--r--. 1 david david     886 Nov 28 14:12 aws_security_groups.tf
drwxr-xr-x. 1 david david     284 Nov 14 11:45 builds
-rw-r--r--. 1 david david     248 Nov 14 11:45 checkov.yml
-rw-r--r--. 1 david david     433 Nov 14 11:45 kics.yml
-rw-r--r--. 1 david david    1168 Nov 27 13:57 module.tf
-rw-r--r--. 1 david david    1138 Nov 14 11:45 outputs.tf
-rw-r--r--. 1 david david 6534343 Nov 28 14:53 plan.json
-rw-r--r--. 1 david david 1410794 Nov 28 15:02 plan.out
-rw-r--r--. 1 david david 6534343 Nov 28 15:04 plan.out.json
drwxr-xr-x. 1 david david      22 Nov 28 14:49 policies
-rw-r--r--. 1 david david    1203 Nov 14 11:45 providers.tf
-rw-r--r--. 1 david david   17176 Nov 27 14:58 README.md
-rw-r--r--. 1 david david   10099 Nov 27 14:58 sbom.xml
drwxr-xr-x. 1 david david      66 Nov 15 14:59 .terraform
-rw-r--r--. 1 david david    9418 Nov 14 11:45 .terraform.lock.hcl
drwxr-xr-x. 1 david david     170 Nov 26 10:06 .tmp
-rw-r--r--. 1 david david   21903 Nov 27 14:39 variables.tf
-rw-r--r--. 1 david david     869 Nov 14 11:45 versions.tf
$ terraform-compliance \
  --features git:https://github.com/terraform-compliance/user-friendly-features.git \
  --planfile plan.out.json
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
terraform-compliance v1.3.48 initiated

Using remote git repository: https://github.com/terraform-compliance/user-friendly-features.git
ERROR: plan.out.json is not a file.

Plan File:

Can not provide due to organization security policy.

Sample Terraform Code:

n/a

Running via Docker:

$ terraform-compliance --version WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64) terraform-compliance v1.3.48 initiated

1.3.48

Error Output:

ERROR: plan.out.json is not a file.

Expected Behavior:

successful test scan execution

Tested Versions:

1.3.48

Additional Context:

  • Fedora 40 guest on QEMU with a Apple M3 host
  • Might be of note, we use Podman in place of Docker

davidjeddy avatar Nov 28 '24 14:11 davidjeddy

I have a feeling your plan.out.json has multiple lines, not a single line JSON :)

Sometimes some terraform wrappers does that :(

eerkunt avatar May 22 '25 08:05 eerkunt

Yep, that was indeed it. I had opened the plan.out.json in an edit and it formatted the file for human reading. IE multiline.

davidjeddy avatar Jul 03 '25 09:07 davidjeddy