The Module Block’s Syntax
When you want to use child modules in the root module, there is a particular syntax you need to make use of. This syntax is part of the module block and is shown in Figure 5.11. Module blocks document the syntax for calling a child module from a parent module, including meta-arguments like for_each
:
Figure 5.11: Syntax and example of a module block
The name specified within " "
after the module
keyword is considered the local name. This is used by other modules to refer to this module.
The content within {}
is called the module body.
This module body contains four arguments:
source
: This is a mandatory argument. This can be a path of a local filesystem or a remote one (Terraform Registry, GitHub, and more). This has to be a literal string, and expressions or variable interpolations are not allowed here.version
: This is used to constrain the version of the modules that can be downloaded. It is...