Calling variables and values from other modules

I am trying to deploy a vpc followed by an aws_instance and cannot figure out how to pull the subnets created from the vpc module and get that data into the instance module. How do you achieve this?

The VPC module must be output’ing value that you can pass to your instance module or resource.

Example here: Use Modules from the Registry | Terraform - HashiCorp Learn

Ah. So if I have a networking module defining my private subnets, I would then have to set an output within that module code like so?

output “subnet_id_private” {
value = aws_subnet.private_subnet[*].id

Then I can pass that value to another module by using:

blah = module.moduleName.outputName