Skip to content

[Q] How to import output from a dependency block? #3907

Open
@gleitoncampos

Description

Hello people!
I have the following structure:

_global
  - route53
    -  terragrunt.hcl (Dedicated to all AWS R53 zones)
dev
  - route53
    - terragrunt.hcl (dedicated to all dns records from dev env)
...  

After the zones creation, the terragrunt give me that output:

route53_zone_zone_id = {
"foo.bar" = "ZXXXXXXXX"
"foo.test" = "ZXXXXXXXX"
}

In terragrunt.hcl, inside the dev/route53 folder, i'm trying to create a new record to be placed in the "foo.test", the second zone created, using the following:

include "root" {
  path = find_in_parent_folders("root.hcl")
}

terraform {
  source = "terraform-aws-modules/route53/aws//modules/records?version=4.1.0"
}

dependency "r53_zones" {
  config_path = "../../_global/route53"
}

inputs = {
    records = [
        {
        name = "dev"
        zone_id = dependency.r53_zones.outputs.route53_zone_zone_id["foo.test"]
        type = "A"
        ttl = 3600
        records = "10.10.10.1"
        },
    ]

}

But I receive an error saying "The given key does not identify an element in this collection value."
Someone can point me the problem here?
Thanks :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    awaiting responseWaiting for a response or more data from issue reporter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions