My RDS Module has dependencies to my App Module with vpc_id
and subnets
.
So I want my RDS module to take vpc_id and subnets from my app module.
Based on dependencies section in the docs I created to following setup:
But when I run plan-all in stage
I get asked to enter vpc_id and subnets.
myProject:
modules:
app:
- main.tf
- terragrunt.hcl # empty file
rds:
- main.tf
- terragrunt.hcl
prod:
stage:
eu-west-1:
db:
- terragrunt.hcl
The content of myProject/modules/rds/terragrunt.hcl
is
dependency "vpc" {
config_path = "../app"
}
inputs = {
vpc_id = dependency.vpc.outputs.vpc_id
subnet_ids = dependency.vpc.outputs.private_subnets
}
This is the content of my myProject/stage/eu-west-1/db/terragrunt.hcl
locals {
environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))
region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
env = local.environment_vars.locals.environment
aws_region = local.region_vars.locals.aws_region
}
terraform {
source = "${get_parent_terragrunt_dir()}/modules/rds/"
}
include {
path = find_in_parent_folders()
}
inputs = {
name = "sample-rds"
}