hello, Id like some help writing a config file tem...
# help
n
hello, Id like some help writing a config file template to match my directory structure. The terraform directories in my repo exist at many sublevels all within a single
terraform
directory, and if possible Id like to just wildcard match all subdirectories within
terraform/
. Example structure:
Copy code
|--terraform
|  |--top_level
|  |  |--<http://main.tf|main.tf>
|  |--subdirs
|  |  |--subdir1
|  |  |  |--<http://main.tf|main.tf>
|  |  |--subdir2
|  |  |  |--<http://main.tf|main.tf>
|  |--more_subdirs
|  |  |--subdir3
|  |  |  |--subdir4
|  |  |  |  |--<http://main.tf|main.tf>  
|--infracost.yml.tmpl
Is something like this possible? Ideally I dont want to have to separately configure every level of subdirectory. I just want infracost to run on every dir within
terraform/
l
@narrow-dinner-45042 something like this might work:
Copy code
version: 0.1
projects:
{{- range $project := matchPaths "terraform/:name(.*)/main.tf" }}
  - path: {{ $project._dir }}
    name: {{ $project.name }}
{{- end }}
n
ooo, thanks! Ill try it out
l
let me know if it works
n
that appears to work!
thank you
l
No worries!
n
hi @little-author-61621, following up on this thread. I added an
infracost.yml.tmpl
to the root of my repo and integrated infracost with the repo, but I am seeing infracost still running checks on PRs that dont touch any paths in my config file. Is this expected? Do these runs count against the 1000 runs/mo even if they detect no terraform changes?
l
If you have the
Only post a comment in pull requests that have Terraform changes (default)
setting turned on then any run that has no tf changes won’t be counted. Otherwise all runs are counted even if the paths aren’t specified in the config file because Infracost still runs to parse and check the config file paths.
n
got it, thanks!