This message was deleted.
# general
b
This message was deleted.
w
Try init terraform command first and than push breakdown to path.
p
Thanks but I have already run terraform init. The terraform code deploys successfully without errors. I only see the error above when running Infracost. Could it be because I'm referencing modules externally?
c
Hi Mark, that looks somewhat similar to this issue which was fixed last month: https://github.com/infracost/infracost/issues/1730 Can you try running Infracost with the
--terraform-force-cli
flag as a workaround. It calls the Terraform binary to generate a plan file so it is much slower than our normal method of parsing the HCL directly. Alternatively, you can pass a plan.json directly to
--path
p
@crooked-daybreak-55253 Thanks very much for the quick response. I can now see costs. This is going to be a game changer here in a few weeks. One related question as the docs don't seem to indicate how to use the diff command on a cli. Could you confirm if my process is correct to get a diff cost: Get current costs:
infracost breakdown --path . --terraform-force-cli --format json --out-file infracost-base.json
Edit main.tf and increase disk allocation on a vm Get difference in costs:
infracost diff --path . --terraform-force-cli --compare-to infracost-base.json
Does that look correct as when I run it there are no changed detected.?
c
Yes that is correct. There would be no changes detected if you haven’t changed anything between running
breakdown
and
diff
. If you modify your .tf and run diff again, you should see the change reflected (if it has a cost impact of course).
A typical thing to do is run breakdown against a
main
or
master
branch to generate the
infracost-base.json
, then run
diff
on a feature branch.
p
ok it didn't show any cost diffs until I upgraded to the latest version Infracost v0.10.7 This version works as expected. Again, thanks very much. Have a great weekend.
👍 1