gentle-animal-85879
06/21/2024, 2:44 PMmysterious-teacher-68276
06/21/2024, 2:46 PMgentle-animal-85879
06/21/2024, 3:10 PMgentle-animal-85879
06/21/2024, 3:21 PMUnsupported attribute; This object does not have an attribute named "aws".
This object does not have an attribute named "terraform_version".
This object does not have an attribute named "dependencies".
mysterious-teacher-68276
06/21/2024, 3:23 PMgentle-animal-85879
06/21/2024, 3:27 PMgentle-animal-85879
06/24/2024, 8:24 AMmysterious-teacher-68276
06/24/2024, 8:26 AMgentle-animal-85879
06/24/2024, 10:37 AMinfracost-baseline.json
and infracost.json
. But, when i use infracost diff
with the two files I get this error:
Error loading infracost.json used by --compare-to flag. invalid Infracost JSON file invalid character 'P' looking for beginning of value, generate it by running the following command then try again:
infracost breakdown --path /code --format json --out-file infracost-base.json
gentle-animal-85879
06/24/2024, 10:51 AMUnsupported attribute; This object does not have an attribute named "aws".
This object does not have an attribute named "terraform_version".
This object does not have an attribute named "dependencies".
gentle-animal-85879
06/24/2024, 11:22 AMError: Error loading tfplan-new.json used by --compare-to flag. invalid Infracost JSON file version. Supported versions are 0.2 ≤ x ≤ 0.2
mysterious-teacher-68276
06/24/2024, 11:54 AMmysterious-teacher-68276
06/24/2024, 12:10 PMUnsupported attribute; This object does not have an attribute named “aws”.
This object does not have an attribute named “terraform_version”.
This object does not have an attribute named “dependencies”.Hi henry this error looks like to comes from the fact that your using terragrunt
run_cmd
to run terragrunt and fetch certain config files. Infracost does not support this with our HCL parsing approach as we do not exec any external binaries in our ephemeral runners. For this to work you’ll need to rely on the plan JSON, which you are already attempting.
Can I request you paste the exact command you are using to :
1. generate a terraform plan json
2. run a diff
From the error that you have sent it seems that the plan JSON is malformed somehowgentle-animal-85879
06/24/2024, 12:41 PMrun_cmd
command.gentle-animal-85879
06/24/2024, 12:43 PMterragrunt plan -out tfplan-baseline.binary
terraform show -json tfplan-baseline.binary >tfplan-baseline.json
infracost breakdown --path tfplan-baseline.json
terragrunt plan -out tfplan-new.binary
terraform show -json tfplan-new.binary >tfplan-new.json
infracost breakdown --path tfplan-new.json
infracost diff --path tfplan-baseline.json --compare-to tfplan-new.json
gentle-animal-85879
06/24/2024, 12:44 PMmysterious-teacher-68276
06/24/2024, 12:46 PM--compare-to
is not needed with a tf plan json, this is solely for the HCL version, so what happens if you run
infracost diff --path tfplan-baseline.json
gentle-animal-85879
06/24/2024, 12:49 PMINFO Autodetected 1 Terraform plan JSON file project across 1 root module
INFO Found Terraform plan JSON file project tfplan-baseline.json at directory tfplan-baseline.json
──────────────────────────────────
9 cloud resources were detected:
∙ 1 was estimated
∙ 8 were free
mysterious-teacher-68276
06/24/2024, 12:50 PMmysterious-teacher-68276
06/24/2024, 12:50 PMinfracost breakdown --path tfplan-baseline.json
givegentle-animal-85879
06/24/2024, 12:50 PMinfracost diff --path tfplan-new.json
mysterious-teacher-68276
06/24/2024, 12:50 PMmysterious-teacher-68276
06/24/2024, 12:50 PMgentle-animal-85879
06/24/2024, 12:51 PMmysterious-teacher-68276
06/24/2024, 12:52 PMgentle-animal-85879
06/24/2024, 12:54 PMgentle-animal-85879
06/24/2024, 12:54 PMmysterious-teacher-68276
06/24/2024, 12:57 PM