This message was deleted.
# help
b
This message was deleted.
c
Hi, you can pass a state JSON to the CLI. So use the terraform show command with the
-json
flagto convert your .tfstate to a state JSON, then call
infracost breakdown -path=tfstate.json
Have you tried the HCL parsing though? In general we don’t recommend using plan.json files anymore. You can pass the terraform project directory as
--path
and we’ll generate an estimate directly from the .tf files, i.e.
infracost breakdown --path=./my/terraform_project
. It tends to be much faster than generating a plan json.
f
so what we're doing on our backend for our platform is storing params set by customers in the UI. we don't want to run the estimator based on the params because customers can save params without deploying them
to be as accurate as possible for the costs our customers may see on their bill, we just want infracost to read the customer's statefile (stored in our s3 bucket) and generate the estimated cost from what's actually deployed
@crooked-daybreak-55253 I was able to get this working. how can i convert the breakdown into a scrapable file like JSON or something?
👍 1
c
add a
--format=json
flag to the breakdown command. You can also set
--out-file=infracost.json
to put it in a file
❤️ 1
w
@faint-oyster-21329 if you’re building an integration with Infracost, please follow these guidelines.
👍 1