Terragrunt: Auto-init is not working

Created on 30 Oct 2019  路  3Comments  路  Source: gruntwork-io/terragrunt

In one of my repos, I recently added a new submodule to an existing module. Since then, plan-all no longer works for these directories. It appears that terragrunt is not detecting and running terraform init. After running terraform init in each of these directories, subsequent plan-all tasks work.

Katara:cardsavr-deploy ted$ terragrunt plan
[terragrunt] 2019/10/30 13:06:42 Reading Terragrunt config file at /Users/ted/code/switch/terraform/tenants/acmebank/cardsavr-deploy/terragrunt.hcl
[terragrunt] [/Users/ted/code/switch/terraform/tenants/acmebank/cardsavr-deploy] 2019/10/30 13:06:42 Running command: terraform --version
[terragrunt] 2019/10/30 13:06:43 Running command: terraform plan

Error: Module not installed

  on ../../../cardsavr/deploy/cat.tf line 94:
  94: module "cleanup_pcoss_jobs" {

This module is not yet installed. Run "terraform init" to install all modules
required by this configuration.


Error: Module not installed

  on ../../../cardsavr/deploy/cat.tf line 105:
 105: module "generate_vbs_dashboard" {

This module is not yet installed. Run "terraform init" to install all modules
required by this configuration.


Error: Module not installed

  on ../../../cardsavr/deploy/cat.tf line 116:
 116: module "autoscale_vbs" {

This module is not yet installed. Run "terraform init" to install all modules
required by this configuration.

[terragrunt] 2019/10/30 13:06:45 Hit multiple errors:
exit status 1
question

Most helpful comment

Are you using any of the following in the terragrunt source?

  • Local references (e.g source = ../module)
  • Remote references with no ref tag
  • Remote references with a ref tag that is a branch

In each of these cases, Auto Init is known to not work correctly. At a high level, the underlying mechanism is checking for changes in the source tag to decide when to run init.

All 3 comments

Are you using any of the following in the terragrunt source?

  • Local references (e.g source = ../module)
  • Remote references with no ref tag
  • Remote references with a ref tag that is a branch

In each of these cases, Auto Init is known to not work correctly. At a high level, the underlying mechanism is checking for changes in the source tag to decide when to run init.

Yes, source = ../module is in use. That makes sense. Are there any plans to remedy this, i.e. running terraform get before operations?

@yorinasub17, the cases you mentioned, in which Auto Init is known to not work (or even not 'always' work), is it worth documenting these on Auto-Init documentation please?

At the moment, that page only has a generic note like so, which is helpful, but not helpful enough:

Note that there might be cases where terragrunt does not properly detect that terraform init needs be called. In this case, terraform would fail. Running terragrunt init again corrects this situation.

In case you agree, I've created https://github.com/gruntwork-io/terragrunt/pull/1026 with this amendment to the documentation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zachwhaley picture zachwhaley  路  3Comments

dzirg44 picture dzirg44  路  3Comments

goseeped picture goseeped  路  3Comments

mpkerr picture mpkerr  路  3Comments

MacFlurry picture MacFlurry  路  4Comments