Cannot use module variables in parent .tf
pplanel opened this issue · 1 comments
pplanel commented
My folder structure:
-- proj
--- main.tf
--- vpc
---- vpc.tf
---- variables.tf
I'm trying to use the public_subnets
and the default_security_group_id
output variables in my main.tf.
My module declaration is this:
module "myModule" {
and in my instance im trying to use like this:
vpc_security_groups_ids
= "${module.myModule.default_security_group_id}"
but when i run terraform plan
it yields the follow:
resource 'aws_instance.bastion' config: unknown module referenced: myModule
antonbabenko commented
Check source
argument inside module "myModule"
in your main.tf
. It should be like source="./vpc"
.
Make sure that you run terraform get
or terraform init
before running plan
.
If this doesn't help, please show more of your main.tf