Hello, I'm having a bit of trouble to make a worki...
# help
r
Hello, I'm having a bit of trouble to make a working Config File: I have a mono-repo with app infra stored like:
Copy code
+---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
w
@ripe-salesclerk-14140 try this: 1. Add a
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 🙂
Copy code
version: 0.1
autodetect:
  env_names:
    - dv
    - pr
    - sy
3. From the repo root, run these two commands.
Copy code
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).