ripe-salesclerk-14140
09/24/2024, 10:15 PM+---AppONE
| | <http://main.tf|main.tf>
| | <http://variables.tf|variables.tf>
| \---tfvars
| dv.tfvars
| pr.tfvars
| sy.tfvars
|
+---AppTWO
| | <http://main.tf|main.tf>
| | <http://variables.tf|variables.tf>
| \---tfvars
| dv.tfvars
| pr.tfvars
| sy.tfvars
white-airport-8778
infracost.yml.tmpl
file to the repo too, so on the same level as AppONE/AppTWO.
2. In the above file, put the following. This is a new simpler autodetect syntax that we’ll be documenting in our public docs soon 🙂
version: 0.1
autodetect:
env_names:
- dv
- pr
- sy
3. From the repo root, run these two commands.
infracost generate config --repo-path . --template-path infracost.yml.tmpl --out-file infracost.yml
infracost breakdown --config-file infracost.yml
Notes:
• You should either hardcode the above config tmpl file in your CI/CD pipeline if all repos use these project names, or put the .tmpl file in each repo. The .yml file should be generated in CI/CD as the project list can change in each repo, e.g. some repos might not have sy
.
• Infracost Cloud already has a central config file you can put this in if you’re using the GitHub/GitLab App (and soon the Azure Repos App).