Hi Team, I've a CICD setup for terraform in AWS co...
# help
b
Hi Team, I've a CICD setup for terraform in AWS codebuild and there is a shell script which helps my CICD runs. During each CICD run, infracost cli will get installed and it will be used to calculate cost and
cost estimate
will be added as comment in github PR. But i'm also getting this "Governance checks" as part of my PR. Is there any way to remove this from my PR?
Copy code
terraform show -json tfplan > ${file_prefix}/plan.json
      echo "Running Infracost breakdown..."
      infracost breakdown --path ${file_prefix}/plan.json --format json --out-file ${file_prefix}/infracost-output.json
      echo "Infracost breakdown completed."
      # Filter out Governance checks from JSON
      jq 'del(.projects[].breakdown.governance_checks)' ${file_prefix}/infracost-output.json > ${file_prefix}/infracost-output-filtered.json
      infracost comment github --repo $GIT_ORG/$GIT_REPO --path ${file_prefix}/infracost-output-filtered.json --github-token $git_token --pull-request $pr_number --behavior=new
For more clarity, 1. I'm passing json plan to Infracost cli. 2. Infracost cli performs it's actions 3. i'm trying to remove governance checks from infracost output json (not sure if governance checks is part of infracost json output) 4. Printing the infracost output in my PR
w
@bright-toddler-17549 yes, you can go to dashboard.infracost.io > Org Settings and disable the “Cost monitoring” tick box, that disables the Infracost Cloud features
b
Thanks @white-airport-8778 But I haven't connected my Github repo because the repo is part of my org .. so I'm not able to access the options
is there any other way to disable it?
w
Nope, you need to ask the person who configured Infracost to disable that.
b
Previously I used my personal Gmail login and got an API key from infracost,
Governance checks
was not part of the PR at that time. But this time, I got API keys using my Org email .. these options are enabled by default for org email id's?
w
I’m a bit confused, did you get an API from dashboard.infracost.io or did someone send you an API key? if it’s the former then you can login to disable it. if it’s the latter, maybe they’re still in the 14 day trial period, after that these settings get disabled automatically unless the upgrade.
b
@white-airport-8778 So let me explain, I executed the below command in my terminal
infracost auth login
It took me to infracost login page, I used my Org gmail credentials and then I got the API key
w
great, now go to dashboard.infracost.io and you should be able to login too in the same way you logged in from the CLI (google, github or email/pwd)
b
if it's the latter, maybe they're still in the 14 day trial period, after that these settings get disabled automatically unless the upgrade.
You mean
Governance checks
will get disabled but I will be able to still use my 1000 API runs for infracost calculation right?
w
correct
b
And 1000API runs will be free for everymonth? If it exceeds, then I have to purchase for 10K API runs. Is my understanding correct here? @white-airport-8778
w
yep!
b
Thanks @white-airport-8778 for the help .. let me check from my end for
Governance checks
thing and get back if any help is needed
w
great 🙂
These docs pages explain those capabilities: https://www.infracost.io/docs/infracost_cloud/finops_policies/ and https://www.infracost.io/docs/infracost_cloud/tagging_policies/ Often engineering management and FinOps teams look for that.
b
@white-airport-8778 one thing i would like to understand here out of curiosity. I haven't connected my repo to infracost dashboard, but how these governance checks are getting added in my PR. Are those present in my infracost JSON output. I would like to understand how that works
w
The policies are setup and configured in Infracost Cloud, so when the CLI runs it fetches the policies from Infracost Cloud (since the feature is enabled) and the CLI evaluates them locally against the HCL code or the plan JSON file. Then the results are output in the infracost.json and sent to Infracost Cloud (again as the feature is enabled). When your trial finishes, the governance features are disabled so the CLI just does the cost estimate.
b
Then the results are output in the infracost.json
- that means governance checks will also be there in my output json? In that case, will I be able to remove it and print?
w
answered in DM as that was easier 🙂