Skip to content

autoinclude fails to override "config_path" parameter if set to attribute of "values" in unit source #6692

Description

@sschill0

Describe the bug

When overriding dependency blocks with an autoinclude, an error will throw if config_path was originally set to an attribute of values which is no longer set due to being unused in the new dependency.

Image

Reproducing bugs

The following sort of structure with a source dependency set to an attribute of values causes an "Unsupported attribute" error to throw when the unit source file is parsed.

# units/transit-gateway-vpc-attachment/terragrunt.hcl
# ... omitted for brevity
dependency "vpc" {
  config_path = values.vpc_path # should be overridden by autoinclude but access is attempted when undefined
  
  mock_outputs = {
    vpc_id = "mock-vpc-id"
  }
}
# ... omitted for brevity
# stacks/prod/terragrunt.stack.hcl
# ... omitted for brevity

unit "transit_gateway_vpc_attachment" {
    source = "../../../units/aws/transit-gateway-vpc-attachment"

    path = "transit-gateway-vpc-attachment"

    autoinclude {
        dependency "vpc" {
            config_path = stack.mgmt_infra.path # no longer set to values.vpc_path

            mock_outputs = {
                vpc = {
                    vpc_id = "mock-vpc-id"
                }
            }
        }

        inputs = {
            vpc_id = dependency.mgmt_infra.outputs.vpc.vpc_id
            azs = dependency.mgmt_infra.outputs.vpc.azs
        }
    }

    values = {
        // Required inputs
        name = local.name

        // Dependency paths
        # no longer setting "vpc_path" in values due to the autoinclude overriding it
        transit_gateway_path = unit.transit_gateway.path
    }
# ... omitted for brevity

Expected behavior

The config_path parameter should be overridden without attempting to access the unused attribute of values.

Must haves

  • Steps for reproduction provided.

Nice to haves

  • Terminal output
  • Screenshots

Versions

  • Terragrunt version: v1.1.3
  • Terraform version: v1.15.8
  • Environment details (Ubuntu 20.04, Windows 10, etc.): Fedora 44

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpreservedPreserved issues never go stale

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions