Closed dratspiker closed 3 years ago
It looks like you are referencing the dependency
resource in terraform. dependency
is a terragrunt construct and only available in terragrunt.hcl
. The idea is to feed the dependency to the terraform module using variable inputs. So in this case, you want to replace whereever you were referencing dependency
in your terraform module with a variable, and have terragrunt set that variable in the inputs
map in the terragrunt.hcl
.
Thank you for your help. I guess I need to figure out how to set the variable from the outputs of the vpc module. I am learning terraform and terragrunt at the same time so I sometimes get lost in the interplay between the two.
When running
terragrunt plan
in /spoke07/subnet/, I get the following undeclared resource error after following these instructions for setting up a dependency. I believe it is because I do not have the variable from the subnet.tf file mapped back to the corresponding terragrunt.hcl correctly but I have not been able to figure out the fix. I have confirmed thatterragrunt output
at /spoke07/vpc/ outputs the vpc-id./spoke07/subnet/terragrunt.hcl
/tf-spoke/vpc/outputs.tf
/tf-spoke/subnet/subnet.tf
Directory structure.