Skill 5.3.1

Calling a module

Key Concepts

module "vpc" { source = "terraform-aws-modules/vpc/aws" version = "~> 6.0" name = "main" cidr = "10.0.0.0/16" } calls a registry module. The label, here vpc, is the module's local name and becomes part of every address inside it, such as module.vpc.aws_vpc.this[0]. After adding or changing a module block, run terraform init to install it.

Read the module's documentation for its required inputs and outputs. Registry pages list them, together with the providers the module needs. A module's resources are planned and applied with the rest of the configuration, and they appear in the plan under the module's address.