-
-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable expansion in infracost #334
Comments
@MaxymVlasov Could you put your infracost |
Hmm, can you provide an example where you need
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.64.0
hooks:
- id: infracost_breakdown
args:
- --args=--config-file=infracost.yml
# - --args=--path=./environment/qa
- --hook-config='.totalHourlyCost >= 0.1'
- --hook-config=".totalHourlyCost|tonumber > 1"
- -h ".projects[].diff.totalMonthlyCost|tonumber!=10000"
- -h [.projects[].diff.totalMonthlyCost | select (.!=null) | tonumber] | add > 1000
verbose: true # Always show costs
version: 0.1
projects:
- path: ./environment/qa Feel free to reopen the issue. |
Is that infracost.yml in the top level dir? Because I think I need to create specific ones per TF workspace. So if I edit a file in something like ops/stg/main.tf it would trigger the infracost and use the config file found in ops/stg/infracost.yaml |
Here not in a root, works fine too
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.64.0
hooks:
- id: infracost_breakdown
args:
- --args=--config-file=test/infracost.yml
- --hook-config='.totalHourlyCost >= 0.1'
- --hook-config=".totalHourlyCost|tonumber > 1"
- -h ".projects[].diff.totalMonthlyCost|tonumber!=10000"
- -h [.projects[].diff.totalMonthlyCost | select (.!=null) | tonumber] | add > 1000
verbose: true # Always show costs
version: 0.1
projects:
- path: ./environment/qa |
Sry I've been negligent here. Finally had some time to circle back to this and maybe I'm misunderstanding how this should be designed. Say I had multiple workspaces that existed in the same repo like this:
And I wanted infracost to run anytime a file a was changed in a SERVICE/ENV dir. How would I structure this if I have different AWS profiles I need to sue depending on ENV? Trying your method still requires me to have a block defining the config file in my top level pre-commit-config.yaml and it would run that against every service every time which isn't entirely needed. |
Ok, maybe I get this. So I should jsut refference 1 infracost.yaml file that has a large set of
|
I am trying to use the infracost pre-commit hook and wondering if there was a way to mimick the FR in this issue: #264
Trying to use the macros so I can have specific config files per project and it appears to not be expanding the GIT_WORKING_DIR variable.
The text was updated successfully, but these errors were encountered: