terragrunt unable to get the outputs from dependency #768
Unanswered
srinathjamboju92
asked this question in
Help
Replies: 2 comments 2 replies
-
Hello, |
Beta Was this translation helpful? Give feedback.
2 replies
-
hey @srinathjamboju92 did you try to run the above without the dependency "vpc" {
... maybe there is a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm seeing a problem with terragrunt not being able to get the outputs from modules that needs to be passed as inputs to dependent modules.
Below is the list of resources that are being attempted to create. Please note that this problem happens when terragrunt tries to create both parent and dependent resources for the first time.
Parent Resource:
Dependent Resource:
I've below on the EKS Module:
Now when I run terragrunt run-all apply, I get the below Groups to be applied.
Group 1
Group2
And when confirmed "y" to apply, terragrunt ran inside the test/vpc directory and created the VPC resources and did output the resource attributes such as vpc_id, private_subnets and others.
Now when terragrunt runs inside eks_cluster, it never gets the outputs from the parent module i.e., test/vpc. It always gets the values from mock_outputs while apply is in progress.
I think the issue here is, terragrunt before plans to apply, it gets the outputs from the parent modules and outputs as a json in the dependent(eks in this case) folder and use it to parse the outputs?
If this is the case, run-all apply will never work across the modules, that both parent(eks) and eks gets deployed at same time. This will be a major problem. It's not just VPC that is always a dependency to others. At least in my case, there are quite a few dependency modules, and I need to run
terragrunt apply
in each parent folder before applying in other sub-folders.Is there any work-around for this? I already ready most of the GitHub pages and the below links, none of them could solve the problem of run-all apply at first time when terraform state is empty.
This link explains about unapplied dependency, but doesn't explain that it can or cannot pass outputs to dependent modules while applying for the first time.
The comment here explicitly says, when run-all apply is made, outputs from vpc is written to state and they are used for dependent modules at the same time, but that never worked for me with above config.
There is one more workaround, this is again for run-all plan, never expected to be used for apply, as I need real outputs for apply.
NOTE: If I remove
apply
I know that the mock_outputs are not considered for run-all apply or apply commands, but when did so, I get the error that the outputs are not present in the parent module. And when apply is used, terragrunt never looks at state to get the outputs generated in the dependent module to use instead.terragrunt version: v0.50.16
terraform version: v1.5.5
Tracked in ticket #110448
Below is the error log from the terminal output:
Beta Was this translation helpful? Give feedback.
All reactions