Terragrunt: No Terraform configuration files found in directory

Created on 17 Aug 2017  ·  9Comments  ·  Source: gruntwork-io/terragrunt

A common issue we get from Terragrunt users is something like the following error:

Downloading modules (if any)...
Get: git::ssh://[email protected]/gruntwork-io/module-ecs.git?ref=v0.5.0
Error downloading modules: Error loading modules: module ecs_service: No Terraform configuration files found in directory: /private/var/folders/s1/fmkvqbdj0v38wzyd3sck_v0h0000gn/T/terragrunt/BD_3wScLWM0rOaX4H6GqMvg1KEw/lc2S_-xSO1M5_VZbM9r3nLEbEtc/services/finance-system/.terraform/modules/2c57b312914a8bcbf55a756c539a1bba/modules/ecs-service-with-alb

What's happening here is that Terragrunt starts by downloading the module files referenced in the terragrunt.terraform.source property of a terraform.tfvars file to a temp directory. After a while, your local OS may simply delete these temp files (after all, they're temporary!), but not necessarily the containing folder. This confuses Terragrunt since it sees that the temp folder still exists, even though it's now empty. Hence you get the error that "No Terraform configuration files found in directory".

A workaround is to simply use the --terragrunt-source-update option with Terragrunt (e.g. terragrunt apply --terragrunt-source-update) so that Terragrunt will re-download all files to a new temp directory.

A fix for this would update Terragrunt to pre-verify that the temp directory it sees is non-empty, and possibly automatically run with the --terragrunt-source-update option if the directory is in fact empty.

bug help wanted

Most helpful comment

I am having this same issue when trying to download modules from s3 with plain terraform
Error downloading modules: Error loading modules: module my_module: No Terraform configuration files found in directory: .terraform/modules/eaab51770e5add74cf295e21939fa78

@tdigangi5 I am having similar issue , did you get a fix for this ?

All 9 comments

This happens because OS X seems to delete the files in /tmp, but not the folders, whereas Terragrunt's caching is merely checking for the presence of the folder. Should be an easy fix if you're up for it :)

Maybe a path like ~/.terragrunt-cache would be more appropriate than /tmp?

That's actually a great point. I think it would be a simple fix too! PRs welcome :)

does anyone ever meet this problem while execute terraform plan : "Too many command line arguments. Configuration path expected"?

@jinrangcui That sounds like a Terraform error, not a Terragrunt error. Check out the Terragrunt logs to see which terraform command is being run.

I am having this same issue when trying to download modules from s3 with plain terraform
Error downloading modules: Error loading modules: module my_module: No Terraform configuration files found in directory: .terraform/modules/eaab51770e5add74cf295e21939fa78

@josh-padnick ,sorry for the late reply. this issue is resolved now because the “punctuation mark” I used doesn't symmetrical。。 thank you for your comment

I believe this is fixed by #301. The new binaries should show up in https://github.com/gruntwork-io/terragrunt/releases/tag/v0.13.4 shortly. Please try it out!

I am having this same issue when trying to download modules from s3 with plain terraform
Error downloading modules: Error loading modules: module my_module: No Terraform configuration files found in directory: .terraform/modules/eaab51770e5add74cf295e21939fa78

@tdigangi5 I am having similar issue , did you get a fix for this ?

Was this page helpful?
0 / 5 - 0 ratings