terragrunt-atlantis-config icon indicating copy to clipboard operation
terragrunt-atlantis-config copied to clipboard

Missing files in when_modified when cascade-dependencies set to false

Open stdmje opened this issue 2 years ago • 1 comments

Hi! I just found something that IMHO is not working as expected.

When i set --cascade-dependencies=false there are missing files in the when_modified block.

Example:

I have the following:

resource_a.hcl

include "root" {
  path = find_in_parent_folders()
}

include "envcommon" {
  path   = "${dirname(find_in_parent_folders())}/_envcommon/resource_a/terragrunt.hcl"
  expose = true
}

resource_b.hcl

include "root" {
  path = find_in_parent_folders()
}

include "envcommon" {
  path   = "${dirname(find_in_parent_folders())}/_envcommon/resource_b/terragrunt.hcl"
  expose = true
}

In "${dirname(find_in_parent_folders())}/_envcommon/resource_b/terragrunt.hcl" i have the following dependency block.

dependency "resource_a" {
  config_path = "${dirname(find_in_parent_folders("env.yaml"))}/resource_a"
}

resource_c.hcl

include "root" {
  path = find_in_parent_folders()
}

include "envcommon" {
  path   = "${dirname(find_in_parent_folders())}/_envcommon/resource_c/terragrunt.hcl"
  expose = true
}

In "${dirname(find_in_parent_folders())}/_envcommon/resource_c/terragrunt.hcl" i have the following dependency block.

dependency "resource_b" {
  config_path = "${dirname(find_in_parent_folders("env.yaml"))}/resource_b"
}

If i set --cascade-dependencies=true all the dependencies including the files referenced in the include blocks are added to the when_modified block.

Then if i set --cascade-dependencies=false the atlantis.yaml file generated for resource_c is not including the file referenced in the include block from resource_b but i think it should since resource_b is a direct dependency of resource_c.

The idea of --cascade-dependencies=false is to not include dependencies of the dependencies, but all the include blocks for a direct dependency should be included.

Let me know what do you think.

Thanks for your support! All the best

stdmje avatar Dec 29 '22 12:12 stdmje

I just found that the same behaviour happens if in a direct dependency i set the extra_atlantis_dependencies local. It just ignores it when using --cascade-dependencies=false

stdmje avatar Dec 29 '22 13:12 stdmje