Terragrunt: Did not find any Terraform files (*.tf) Error

Created on 18 Jun 2020  ·  8Comments  ·  Source: gruntwork-io/terragrunt

I've recently upgraded terragrunt from version 0.23.7 to 0.23.27, with this upgrade seems like dependency block is broken.

My dependency block is like:

dependency "vpc" {
  config_path = "../vpc"

  mock_outputs_allowed_terraform_commands = ["validate"]
  mock_outputs = {
    subnet_ids        = ["12323", "s432332f", "4365656"]
    asg_sec_group_ids = ["sg-45454", "sg-6677", "sg-8867"]
  }
}

dependency "iam" {
  config_path = "../../_global/iam"

  mock_outputs_allowed_terraform_commands = ["validate"]
  mock_outputs = {
    instance_profile_name = "ec2_instance_profile"
    pub_key_name          = "3453534543.pub"
  }
}

usually with version 0.23.7 when i run terragrunt plan --terragrunt-source ../../modules//cluster it works without any errors.

With the upgrade when i run the same command i see the following:
Encountered the following errors:
Did not find any Terraform files (*.tf) in /Iac/gitlab.com/company/devops/modules.git/iam

when i checked the .terragrunt-cache dir it has hcl files along wth .terragrunt-module-manifest file

Contents of .terrgarunt-module-manifest

2��fileManifestEntry��Path
                          IsDir������/Users/jack/vpc/.terragrunt-cache/DK92S8IB_UqsPV0UlJMCXGfRH0A/G1SNNliYX3qhKcNQzSK2yFhNVa4/[email protected]:/Iac/gitlab.com/company/devops/modules.git/iam/terragrunt.hcl%
  • Not sure why it's using gitlab git dir and copies terragrunt file instead of modules folder with tf files. Although i used terragrunt source flag to use local dir instead of git dir for local testing

  • I've tried running it plan-all to test multiple dependencies it still throws the same error

question

All 8 comments

I'm guessing it's due to the changes here: https://github.com/gruntwork-io/terragrunt/releases/tag/v0.23.9. Could you take a look at those release notes and let us know if that helps?

i've tried using both / and // and it still throws the same error with v0.23.27

terragrunt plan --terragrunt-source ../../modules//cluster
terragrunt plan --terragrunt-source ../../modules/cluster

Is the iam module in a different repo than the cluster repo? E.g., is it at the path ../../modules//iam?

The change in v0.23.9 is that the terragrunt-source flag now updates all the sources, including the dependency block. E.g., if in your iam module terragrunt.hcl you had:

terraform {
  source = "some-git-repo/modules//iam"
}

the terragrunt-source flag with the dependency will be the same as passing in ../../modules//iam (as in, it replaces everything before // in the terraform source of terragrunt.hcl with whatever is before // in the option you pass in to --terragrunt-source).

@jack-of-AllTrades ,

Have you figured out a work-around? I am experiencing the exact same issue. I had to go back to terragrunt v0.23.8 in order to get things working again.

@cedelis there's no other workaround. Seems like we need to wait for #1138 to be merged. The only workaround is to use git repo.

@yorinasub17 yes it's in the same path. It fails whenever i update terragrunt version above 0.23.27.

I also experienced the same issue. But after I read @yorinasub17 explanation, I was able to solve after carefully checked the configuration. I'm using terragrunt version v0.23.36

Context: I cloned and re-created a new live repo from an existing live repo. As I copied from another live repo, all terragrunt.hcl files originally has source pointing to git.

Let's say I've Service A and B. Service B has service A as a dependency. When I ran terragrunt command in service A with terragrunt-source flag, everything works fine.

However, when I ran the same command in service B. I got the error Did not find any Terraform files (*.tf) in ..../.terragrunt-cache/PATH_TO_SERVICE_A. I checked the PATH_TO_SERVICE_A and found there was an additional unexpected sub-folder appended into it. After all the hassle, I was able to determine that the unexpected sub-folder was taken from the git......//UNEXPECTED_FOLDER/SERVICE_B in the source configured in service A. Just same as the explanation

it replaces everything before // in the terraform source of terragrunt.hcl with whatever is before // in the option you pass in to --terragrunt-source

There's no such UNEXPECTED_FOLDER sub-folder in the terragrunt-source I passed onto. Hence, it couldn't find any *.tf files so Terragrunt throw the error

seems like the problem is resolved in v0.25.1

Was this page helpful?
0 / 5 - 0 ratings