Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies among common modules #85

Open
matejkostros opened this issue Apr 18, 2023 · 3 comments
Open

Dependencies among common modules #85

matejkostros opened this issue Apr 18, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@matejkostros
Copy link

Describe the solution you'd like
I would like to have the possibility to reference two modules in _envcommon folder through dependenc[y|ies] block.

Describe alternatives you've considered
I have considered having such dependencies on terraform module level however, this takes away the possibility to use standardized modules

Additional context
When I try to add a dependency to _envcommon like:
_envcommon/dependencies/vpc/terragrunt.hcl
And in my _envcommon/alb.hcl I state a depenency like:

dependency "vpc" {
  config_path = "${dirname(find_in_parent_folders())}/dependencies/vpc/"
}

It resolves to: /work/_envcommon/dependencies/vpc/terragrunt.hcl but fails to load env.hcl:
Call to function "find_in_parent_folders" failed: ParentFileNotFound: Could not find a env.hcl in any of the parent folders of /work/_envcommon/dependencies/vpc/terragrunt.hcl

@matejkostros matejkostros added the enhancement New feature or request label Apr 18, 2023
@ecoupal-believe
Copy link

ecoupal-believe commented Jun 29, 2023

Not sure if it's the same use case but here is how I reference my dependency:

dependency "vpc" {
  config_path = "${get_terragrunt_dir()}/../vpc"
}

@matejkostros
Copy link
Author

I've actually figured it out on my own.
It is sufficient to just place in my _envcommon/alb.hcl following

dependency "vpc" {
  config_path = "../vpc"
}

Then just use the outputs of the dependency like:

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

@matejkostros
Copy link
Author

Can we add it to a documentation README?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants