https://infracost.io logo
#help
Title
# help
r

refined-optician-52834

12/10/2022, 1:45 PM
Is anyone running any kind of command to update their TF module
README.md
files with a table from infracost? I would like to have it work in the same fashion as like
terraform-docs
and just run a command before every commit to have it update the README with a table of cost in the same place on the README every time. Thoughts?
w

white-airport-8778

12/10/2022, 5:32 PM
I think @jolly-pilot-68525 talked about a similar thing, @strong-beard-24103 showed me a repo where he manually does that for modules so the users know rough costs. @mysterious-teacher-68276 is working on a PR to make shields.io work with Infracost so a readme badge can be added…
here’s a sneak preview, it’ll probably ship next week: https://github.com/infracost/docs/pull/341/files
s

strong-beard-24103

12/10/2022, 6:48 PM
Yah, I just do it manually. An automated way would be epic!
j

jolly-pilot-68525

12/10/2022, 6:51 PM
Yeah agree, I was thinking it would work just like terraform-docs in a pre-commit hook but a badge would do the job as well.
w

white-airport-8778

12/10/2022, 6:57 PM
shields.io integration is what we’re shooting for so it’s super easy for anyone to copy/paste the badge code and get the automated cost estimate in all of their repos
s

strong-beard-24103

12/10/2022, 6:59 PM
I'll have to update around 100 repos 😅
w

white-airport-8778

12/10/2022, 7:01 PM
I guess the win is that you update them once and forget about it as the badge is automatically updated (and links to the repo page so ppl can see the summary and breakdown details) - maybe in the future we can even allow them to play with the module inputs on the cost estimate page so they get a more accurate module cost estimate before they deploy it
s

strong-beard-24103

12/10/2022, 7:03 PM
Playing with the inputs would be great. That'd be even better than the AWS calculator for me when estimating stuff
r

refined-optician-52834

12/14/2022, 3:37 PM
Does anyone know if the infracost cli will output in a markdown format? I see table, html, and json is there a command or beta something I can use that would output a "markdown table"?
It looks like the example on this issue just puts the "table" output into a code block. That might actually work. https://github.com/infracost/infracost/issues/43
w

white-airport-8778

12/14/2022, 4:08 PM
Yeah I’ve seen users take the
--format table
and put it into a code block in markdown. The
infracost output --help
command shows the other
--format
options, the
github-comment
one is markdown too (it’s the markdown that’s used to post the PR comment, so it’s more for diffs and not breakdowns).
r

refined-optician-52834

12/14/2022, 4:25 PM
I am 99% of the way there to having a python script that updates my README.md like terraform-docs with a cost table
Just have to figure out how to escape it properly
w

white-airport-8778

12/14/2022, 4:30 PM
@refined-optician-52834 that’s awesome - add
--no-color
and you’ll get what you want, those are color codes you’re seeing
r

refined-optician-52834

12/14/2022, 4:34 PM
oh snap
w

white-airport-8778

12/14/2022, 6:58 PM
The readme badge feature is live 🙂
j

jolly-pilot-68525

12/14/2022, 7:06 PM
nice, I'll be hooking these up ASAP!