terraform-community-modules / tf_aws_vpc

[DEPRECATED] Use https://github.com/terraform-aws-modules/terraform-aws-vpc
Other
211 stars 203 forks source link

Cannot use module variables in parent .tf #40

Closed pplanel closed 7 years ago

pplanel commented 7 years ago

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 7 years ago

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