terragrunt: Unapplied dependency outputs error

Terraform v0.20.2

I’m following along with the documentation (https://github.com/gruntwork-io/terragrunt#unapplied-dependency-and-mock-outputs), but seem to keep running into the error:

Unsupported attribute; This object does not have an attribute named "platform".

I have a pretty straightforward configuration, using mock_outputs, mock_outputs_allowed_terraform_commands, and skip_outputs:

# hosting/terragrunt.hcl

terraform {
  source = "${get_terragrunt_dir()}/../../../core/hosting/module"
}

dependency "platform" {
  config_path = "../platform"

  mock_outputs = {
    api_gateway_name = "test_api_gateway_name"
  }

  mock_outputs_allowed_terraform_commands = ["validate", "plan"]
  skip_outputs = true
}

inputs = {
  api_gateway_name = dependency.platform.outputs.platform
}

Project structure:

root
├── hosting
│   └── terragrunt.hcl
├── platform
│   └── terragrunt.hcl
└── terragrunt.hcl

Is there something I’m missing?

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

@subhash-dream11 I think I have been the same issue as your. This the workflow :

  • apply with terragrunt
  • add ouput “my_new_output” to a module that already has ouputs
  • plan with terragrunt
    • Running command: terraform output -json only shows previous outputs ( “my_new_output” is absent)
    • terragrunt fails with This object does not have an attribute named “my_new_output”

Workaround => use mock_outputs_merge_with_state = true available since terragrunt v0.31.4

If you have skip_outputs = true, then yes. However, if you remove that line, then it will only use the mock_outputs when there are no outputs upstream.

Ah the issue is in this line:

mock_outputs_allowed_terraform_commands = [“validate”]

You are basically telling terragrunt that it can only use the mock_outputs if it is running terraform validate, but in the logs you were running terraform plan, so it doesn’t read the mock_outputs.

You can resolve that particular error by adding plan to the list.