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 output lookup does not use download_dir path #3417

Open
1azunna opened this issue Sep 18, 2024 · 1 comment
Open

Dependencies output lookup does not use download_dir path #3417

1azunna opened this issue Sep 18, 2024 · 1 comment
Labels
awaiting response Waiting for a response or more data from issue reporter

Comments

@1azunna
Copy link

1azunna commented Sep 18, 2024

I tested the 0.67.6 version and version 0.58.10 and i'm getting the same behaviour.

I am trying to use a dependency in my terragrunt resource but i keep getting this error even though the dependent resource has been applied successfully.

level=error msg=/<path>/network/terragrunt.hcl is a dependency of /<path>/database/terragrunt.hcl but detected no outputs. Either the target module has not been applied yet, or the module has no outputs. If this is expected, set the skip_outputs flag to true on the dependency block.

I've confirmed that the module has outputs so i'm not sure what's the problem here.

Here is my root terragrunt.hcl

....
## Centralise plugin caching
terraform {
  before_hook "before_cache" {
    commands     = [get_terraform_command()]
    execute      = ["mkdir", "-p", abspath("${get_repo_root()}/.terraform/plugins")]
  }

  before_hook "workspace" {
    commands = ["plan", "state", "apply", "destroy", "refresh", "output"]
    execute  = [abspath("${get_repo_root()}/scripts/terragrunt-hook-workspace.sh"), local.workspace]
  }

  after_hook "destroy" {
    commands = ["destroy"]
    execute  = [abspath("${get_repo_root()}/scripts/terragrunt-hook-destroy.sh"), local.workspace]
  }

  extra_arguments "terragrunt_plugins" {
    commands = [get_terraform_command()]
    env_vars = {
      TF_PLUGIN_CACHE_DIR = abspath("${get_repo_root()}/.terraform/plugins")
    }
  }
}
download_dir = abspath("${get_repo_root()}/.terragrunt-cache")

Then i have a resource terragrunt.hcl with this setup

dependency "vpc" {
  config_path = "../network"
  mock_outputs = {
    network_self_link = "https://www.googleapis.com/compute/v1/projects/project-name/global/networks/vpc-name"
  }

  mock_outputs_allowed_terraform_commands = ["plan"]
  mock_outputs_merge_strategy_with_state = "shallow"
}

The folder structure is as follows

root
     |_ folder
        |_ subfolder
           |_ resource_1 
           |        terragrunt.hcl
           |_ resource_2
                   terragrunt.hcl
   terragrunt.hcl

I have attached both log files below:
v0.58.10.log
v0.67.6.log

Originally posted by @1azunna in #3156 (comment)

@yhakbar
Copy link
Collaborator

yhakbar commented Oct 15, 2024

Hey @1azunna ,

I'm not sure either, but I will say that provider plugin caching is a pretty nuanced subject, and you might be using a solution that's a lot more complicated than it needs to be. Have you tried using the built-in Provider Cache Server? That's the most reliable (and well tested) way to re-use provider plugins across terragrunt.hcl files.

@yhakbar yhakbar added the awaiting response Waiting for a response or more data from issue reporter label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response Waiting for a response or more data from issue reporter
Projects
None yet
Development

No branches or pull requests

2 participants