Terragrunt: Confusing Error Message when terraform.source property points to an invalid location.

Created on 12 Apr 2017  路  2Comments  路  Source: gruntwork-io/terragrunt

My terraform.tfvars file looked like this:

terragrunt = {
  # Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
  # working directory, into a temporary folder, and execute your Terraform commands in that folder.
  terraform {
    source = "git::[email protected]:Acme/infrastructure-modules.git//iam-cross-account?ref=v0.0.1"
  }

  # Include all settings from the root terraform.tfvars file
  include = {
    path = "${find_in_parent_folders()}"
  }
}

But when I ran terragrunt apply I got a confusing error message:

> terragrunt apply
[terragrunt] 2017/04/11 20:21:29 Reading Terragrunt config file at /Users/josh/source/gruntwork-customers/acme/infrastructure-live/shared-services/_global/iam-cross-account/terraform.tfvars
[terragrunt] 2017/04/11 20:21:29 Cleaning up existing *.tf files in /var/folders/g0/0gkdx3sj4qv5gzxfcznscdpw0000gn/T/terragrunt-download/xSPlOCShGr-BEq4agMzzVPgkP7g=/XrScdtS4ocNoImjgEyzeRNOklAU=
[terragrunt] 2017/04/11 20:21:30 Downloading Terraform configurations from git::ssh://[email protected]/Acme/infrastructure-modules.git?ref=v0.0.1 into /var/folders/g0/0gkdx3sj4qv5gzxfcznscdpw0000gn/T/terragrunt-download/xSPlOCShGr-BEq4agMzzVPgkP7g=/XrScdtS4ocNoImjgEyzeRNOklAU=
[terragrunt] [/Users/josh/source/gruntwork-customers/acme/infrastructure-live/shared-services/_global/iam-cross-account] 2017/04/11 20:21:30 Running command: terraform init git::ssh://[email protected]/Acme/infrastructure-modules.git?ref=v0.0.1 /var/folders/g0/0gkdx3sj4qv5gzxfcznscdpw0000gn/T/terragrunt-download/xSPlOCShGr-BEq4agMzzVPgkP7g=/XrScdtS4ocNoImjgEyzeRNOklAU=
[terragrunt] 2017/04/11 20:21:33 Copying files from /Users/josh/source/gruntwork-customers/acme/infrastructure-live/shared-services/_global/iam-cross-account into /var/folders/g0/0gkdx3sj4qv5gzxfcznscdpw0000gn/T/terragrunt-download/xSPlOCShGr-BEq4agMzzVPgkP7g=/XrScdtS4ocNoImjgEyzeRNOklAU=/iam-cross-account
open /var/folders/g0/0gkdx4sj4qv5gzxfcznscdpw0000gn/T/terragrunt-download/xSPlOCShGr-BEq4agMzzVPgkP7g=/XrRcdtS4ocNoImjgEyzeRNOklAU=/iam-cross-account/README.md: no such file or directory
[terragrunt] 2017/04/11 20:21:33 open /var/folders/g0/0gkdx3sj4qv5gzxfcznscdpw0000gn/T/terragrunt-download/xSPlOCShGr-BEq4agMzzVPgkP7g=/XrScdtS4ocNoImjgEyzeRNOklAU=/iam-cross-account/README.md: no such file or directory
[terragrunt] 2017/04/11 20:21:33 Unable to determine underlying exit code, so Terragrunt will exit with error code 1

The issue turned out to be that the terragrunt.terraform.source property pointed to an invalid location. That is, the git repo didn't have the folder location specified.

So this GitHub issue is really to report two separate things:

  1. When this happens we should have a much friendlier error message.
  2. Tmp folder paths are so longer that it makes logs hard to read. It'd be better if we had logs that looked more like this:

    > terragrunt apply
    [terragrunt] 2017/04/11 20:21:29 Reading Terragrunt config file at /Users/josh/source/gruntwork-customers/acme/infrastructure-live/shared-services/_global/iam-cross-account/terraform.tfvars
    [terragrunt] 2017/04/11 20:21:29 Setting <temp-folder> to /var/folders/g0/0gkdx3sj4qv5gzxfcznscdpw0000gn/T/terragrunt-download/xSPlOCShGr-BEq4agMzzVPgkP7g=/XrScdtS4ocNoImjgEyzeRNOklAU=
    [terragrunt] 2017/04/11 20:21:29 Cleaning up existing *.tf files in <temp-folder>
    [terragrunt] 2017/04/11 20:21:30 Downloading Terraform configurations from git::ssh://[email protected]/Acme/infrastructure-modules.git?ref=v0.0.1 into Temp Folder
    [terragrunt] [../iam-cross-account] 2017/04/11 20:21:30 Running command: terraform init git::ssh://[email protected]/Acme/infrastructure-modules.git?ref=v0.0.1 <temp-folder>
    [terragrunt] 2017/04/11 20:21:33 Copying files from /Users/josh/source/gruntwork-customers/acme/infrastructure-live/shared-services/_global/iam-cross-account into <temp-folder>/iam-cross-account
    open <temp-folder>/iam-cross-account/README.md: no such file or directory
    [terragrunt] 2017/04/11 20:21:33 open <temp-folder>/iam-cross-account/README.md: no such file or directory
    [terragrunt] 2017/04/11 20:21:33 In terraform.tfvars, terragrunt.terraform.source pointed to an invalid location.
    [terragrunt] 2017/04/11 20:21:33 Unable to determine underlying exit code, so Terragrunt will exit with error code 1
    
enhancement help wanted

All 2 comments

Ah, I hit this once before too. Should definitely be fixed.

That is, the git repo didn't have the folder location specified.

We use terraform init to do the downloading. I wonder why it doesn't exit with an error for an invalid path.

Tmp folder paths are so longer that it makes logs hard to read. It'd be better if we had logs that looked more like this:

This is fairly specific to OS X, which has an odd tmp folder. On other OS's it's /tmp...

FYI, the macOS /tmp is a symlink to /private/tmp/.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shaharmor picture shaharmor  路  3Comments

brikis98 picture brikis98  路  4Comments

michelzanini picture michelzanini  路  3Comments

dzirg44 picture dzirg44  路  3Comments

GauntletWizard picture GauntletWizard  路  3Comments