This message was deleted.
# general
b
This message was deleted.
c
Hi! First what version of infracost are you using? It looks like the CLI decided it was a terraform project (
Detected Terraform directory
). Are there files at
/my/path/to/terragrunt/files
that have an extension of
.tf
,
.hcl
,
.hcl.json
, or
.tf.json
?
f
Infracost v0.9.8
Yes there are 2
region.hcl
account.hcl
c
Ok, those file are causing it to decide it’s a
terraform directory
. We have been debating adding something like a
--type
flag so people can explicitly state what their project is. It would be great if you could create a GH issue for your case. As far as work arounds, I can think of three and none of them are great: 1. Adding an empty
terragrunt.hcl
at
/my/path/to/terragrunt/files
will cause the CLI to recognize it as a terragrunt project. I’m not sure if this works, makes sense, or is even possible from a terragrunt perspective. 2. Moving
region.hcl
and
account.hcl
out of ``/my/path/to/terragrunt/files`` will make it search for the nested
terragrunt.hcl
files (up to 5 levels deep).
3. If you could point
--path
to a directory one level above
/my/path/to/terragrunt
it would also search for nested
terragrunt.hcl
(as long as there are no hcl/tf at that directory).
l
If I use infracost diff --path=./app-1 for example, then Infracost will use Terragrunt instead of Terraform and it will run successfully, however since it will execute run-all commands it will take a lot of time to finish which is a problem especially for the CI.
@freezing-spoon-15505 can you explain this case a little more please? Is running
terragrunt run-all
picking up resources that aren't in the
./app-1
directory?
f
I am sorry, there was a misconfiguration by me in this case. It works perfectly. Thanks!
🦜 1
🎉 1
Something that I have noticed. Having a big directory with many terragrunt modules and use run-all in this directory can lead to errors if some of the modules are not configured properly. Can Infracost ignore those errors and show output for the other modules?
w
@freezing-spoon-15505 that’s not a bad idea, so the CLI would log the error and do skip that module vs failing the entire run? Can you please open a GH issue with a short desc and an example so we can track it? I suspect other Terragrunt users might be interested in this too
f
I will open it shortly. For the sake of conversation, Terragrunt is hard to use with many external tools due to how it runs modules and handles state. For example, having Infracost to run
terragrunt run-all plan
in a project with hundreds of modules to get the plan output, takes a lot of time. There is a similar problem with Atlantis which this project is trying to solve terragrunt-atlantis-config. It basically generates atlantis config with all the terragrunt modules that were changed. Hopefully we might see tools like this from the community, for Infracost too.
w
Thanks! this is awesome context. I remember we discussed running step 3 of https://www.infracost.io/docs/iac_tools/terragrunt#how-the-terragrunt-integration-works in parallel but that won’t help if step 2 is the bottleneck (if I understood it correctly?)
f
Yes, that is correct. However, I'm not sure that this is something Infracost should handle.
👍 1
208 Views