Is anyone running any kind of command to update th...
# help
r
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
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
Yah, I just do it manually. An automated way would be epic!
j
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
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
I'll have to update around 100 repos 😅
w
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
Playing with the inputs would be great. That'd be even better than the AWS calculator for me when estimating stuff
r
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
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
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
@refined-optician-52834 that’s awesome - add
--no-color
and you’ll get what you want, those are color codes you’re seeing
r
oh snap
w
The readme badge feature is live 🙂
j
nice, I'll be hooking these up ASAP!