hey vitale :wave:
# general
m
hey vitale 👋
m
Heya
m
the
TF_ROOT
variable needs to point to the directory that contains your terraform root module
m
all my root code is in subdirectories
m
so I’m assuming these are different Terraform projects & not sub modules?
m
correct
inside azure we have multiple projects
same for cloudflare etc...
m
In this case I’d recommend using a config file
here’s a link to the github actions example which uses a config file: https://github.com/infracost/actions/tree/master/examples/multi-project-config-file
and the link to the infracost docs https://www.infracost.io/docs/features/config_file/
which describes the config file in more detail
but essentially you’ll need to define a list of projects in that file and pass it to infracost
e.g:
m
can I add wildcard
TF_ROOT: XYZ/ABC/*
m
With a config file you cannot add a wild card, you’ll need to specify each project as such:
Copy code
version: 0.1

projects:
  - path: azure/project-1
  - path: azure/project-2
Infracost does support auto-detection, which means you’d just pass
ci-infra/path-to/env
without the
*
. But autodetection doesn’t support more fine grained configuration you’d get with a config file. So i’d recommend setting up that
m
So I have a monorepo that has many workspaces
the issue is my workspaces are based on project names and not just dev,ts, prod
so the versions file would be tedious to manage
this is what the hierarchy looks like
m
so do each of these sub folders have all the contained information to run as an individual terraform project (e.g. all required vars)
m
some do some go deeper