No Module named "" is declared in the root module


I was trying to create output module and used in the Dev environment and getting the below error.

vpc_id = module.vpc.vpc_id
No module call named “vpc” is declared in the root module.

Can someone please guide me to get it fixed?

Thank you

Hi @aneee22,

This error message is saying that there is no module "vpc" block in the module where you wrote module.vpc. Some possible causes of that include:

  • The actual module call (module block) has a different name, perhaps due to a typing error.
  • The module "vpc" block is in a different module. In that case, you can’t refer to it from the root module without exporting it from the other module as an output value.

Unfortunately I can’t give any more suggestions without some more information, such as a fuller copy of what your current configuration looks like.