Mock input not loading on new output from dependancy

So I have 2 modules 1 depending on the other.

patching_group -> common

I haven’t re-applied “common” so I know it’s missing some outputs I have added recently.
So I understood that mock are there for that usage.

This is my patching_group terragrunt.hcl:

locals {
  ...
}

terraform {
  source = ...
}

include {
  path = find_in_parent_folders()
}

dependency "common" {
  config_path = "../common"

  mock_outputs = {
    log_bucket = "log-bucket"
    auto_patching_metadata_amazon_linux_patch_baseline = "mock"
    auto_patching_metadata_centos_patch_baseline = "mock"
    auto_patching_metadata_role_arn = "mock"
    auto_patching_metadata_ubuntu_patch_group = "mock"
    auto_patching_metadata_windows_os_apps_patch_baseline = "mock"
  }
}

inputs = {
    auto_patching_metadata_amazon_linux_patch_baseline = dependency.common.outputs.auto_patching_metadata_amazon_linux_patch_baseline
    auto_patching_metadata_centos_patch_baseline = dependency.common.outputs.auto_patching_metadata_centos_patch_baseline
    auto_patching_metadata_role_arn = dependency.common.outputs.auto_patching_metadata_role_arn
    auto_patching_metadata_ubuntu_patch_group = dependency.common.outputs.auto_patching_metadata_ubuntu_patch_group
    auto_patching_metadata_windows_os_apps_patch_baseline = dependency.common.outputs.auto_patching_metadata_windows_os_apps_patch_baseline
    log_bucket = dependency.common.outputs.log_bucket
    patch_maintenance_window_schedule = "cron(20 6 ? * SUN *)" # At 06:20 every Sunday of the month
    patch_maintenance_window_schedule_2 = "cron(20 6 ? * SAT *)" # At 06:20 every Saturday of the month
}

When running init/plan/apply/validate:

terragrunt plan
[terragrunt] [.../patching_groups] 2020/12/18 12:55:47 Running command: terraform --version
[terragrunt] 2020/12/18 12:55:48 Terraform version: 0.13.5
[terragrunt] 2020/12/18 12:55:48 Reading Terragrunt config file at .../patching_groups/terragrunt.hcl
[terragrunt] [.../common] 2020/12/18 12:55:48 Assuming IAM role ...
[terragrunt] [.../common] 2020/12/18 12:55:49 Generated file .../common/.terragrunt-cache/533830599/backend.tf.
[terragrunt] [.../common] 2020/12/18 12:55:49 Running command: terraform init -get=false -get-plugins=false
[terragrunt] [.../common] 2020/12/18 12:57:05 Running command: terraform output -json
[terragrunt] 2020/12/18 12:57:10 .../patching_groups/terragrunt.hcl:29,83-134: Unsupported attribute; This object does not have an attribute named "auto_patching_metadata_amazon_linux_patch_baseline"., and 6 other diagnostic(s)
[terragrunt] 2020/12/18 12:57:10 Unable to determine underlying exit code, so Terragrunt will exit with error code 1

Do I need to specify more things in the mock?

My terragrunt version is:
terragrunt --version
terragrunt version v0.26.7

If I do run in common “terragrunt refresh” then the new outputs will be there and it’s going to work but isn’t what the mock is supposed to replace?

Hi Luigi,

Currently terragrunt mock usage is all or nothing, conditioned on whether or not the outputs are available at the top level. So as long as there is an output, it won’t use the mocks at all. We have been a bit hesitant to implement a merge mode for mocks due to the element of surprise, but open to reconsidering this.

With that said, you can see this comment for some workarounds that exist currently.

Hope this helps!

Yori