Closed esn89 closed 4 years ago
What do your terragrunt.hcl
files look like?
Hi @brikis98
The DNS one looks like:
terraform {
source = "../../../modules/dns"
}
include {
path = find_in_parent_folders()
}
dependency "project" {
config_path = "../../../../resources/dev/us/project"
#skip_outputs = true
mock_outputs = {
project_id = "my-test-dev"
}
mock_outputs_allowed_terraform_commands = ["validate", "plan"]
}
dependency "vpc" {
config_path = "../vpc"
#skip_outputs = true
mock_outputs = {
network_self_link = "vpc.network.test"
}
mock_outputs_allowed_terraform_commands = ["validate", "plan"]
}
dependency "kafka_network" {
config_path = "../../../../services/kafka/dev/us/vpc"
#skip_outputs = true
mock_outputs = {
kafka_network_self_link = "vpc.kafka_network.test"
}
mock_outputs_allowed_terraform_commands = ["validate", "plan"]
}
inputs = {
network_self_link = dependency.vpc.outputs.network_self_link
network_url = dependency.kafka_network.outputs.kafka_network_self_link
project_id = dependency.project.outputs.project_id
}
The VPC one looks like:
terraform {
source = "../../../modules/vpc"
extra_arguments "credentials" {
commands = get_terraform_commands_that_need_vars()
}
}
include {
path = find_in_parent_folders()
}
dependency "project" {
config_path = "../../../../resources/dev/us/project"
#skip_outputs = true
mock_outputs = {
project_id = "my-test-dev"
}
mock_outputs_allowed_terraform_commands = ["validate", "plan"]
}
inputs = {
project_id = dependency.project.outputs.project_id
}
and project:
terraform {
source = "../../../modules/projects"
extra_arguments "credentials" {
commands = get_terraform_commands_that_need_vars()
}
}
include {
path = find_in_parent_folders()
}
dependency "folders" {
config_path = "../folders"
#skip_outputs = true
mock_outputs = {
folder_id = "123443211234"
}
mock_outputs_allowed_terraform_commands = ["validate", "plan"]
}
inputs = {
folder_id = dependency.folders.outputs.folder_id
}
Which folder are you running apply-all
/plan-all
in? And does the folder tree contain all the dependencies, or are they outside of that folder?
@yorinasub17
The folder where I am doing the apply-all/plan-all is in: ../../../modules/dns
. This folder only contains the terragrunt.hcl
for DNS.
The other ones such as VPC and Projects are located elsewhere, which is outside of the folder of ../../../modules/dns
..
Try passing in --terragrunt-include-external-dependencies
in addition to --terragrunt-non-interactive
. Terragrunt tries to use conservative answers for non-interactive
mode, and as such will not automatically include external dependencies.
@yorinasub17
This is the flag that I'm looking for! Thanks so much!
terragrunt version v0.21.6
When I run
terragrunt plan-all
and enter in "yes" for each of the dependencies in the stack, I get a nice output detailing all the resources I need to create including the dependencies. In my example, it's the VPC stack which the DNS stack is dependent on:Output:
Basically what I'm trying to illustrate is that with
terragrunt plan-all
it shows me all the dependencies which needs to be deployed too.However, things are different when I use:
terragrunt plan-all --terragrunt-non-interactive
, it simply shows the DNS module's changes and not the VPC one.With apply-all it is also very similar.
terragrunt apply-all
allows me to enter "yes" for all the modules which will be created and there is no problem.With
terragrunt apply-all --terragrunt-non-interactive
I get this issue:This does not make sense because I expect it's behaviour to create those dependent resources when I run the
terragrunt apply-all --terragrunt-non-interactive
command.