terraform-cost-estimation
terraform-cost-estimation copied to clipboard
How can I integrate it with a GitHub action?
Great tool. would love to continuously acknowledge the estimated price of https://github.com/bridgecrewio/terragoat on every push to master
Hi Barak!
You can do this by running terraform plan on GH action and then sending tfplan file to cost.modules.tf with or without preprocessing via terraform.jq, as described here - https://github.com/antonbabenko/terraform-cost-estimation#example---get-cost-estimates-during-terraform-plan
You can also make your pipeline fail if price is too high:
$ ... | curl -s -X POST -H "Content-Type: application/json" -d @- https://cost.modules.tf/ > costs.json
$ jq 'if .monthly|tonumber > 10 then "$" else "$$$" end' costs.json