module block, which contains the module keyword, module name, and module body (the part within the {}) as shown below:module "servers" {source = "./app-cluster"servers = 5}
module can be called using the following arguments:source: Specifies the source of the referenced module.version: Specifies the version number of the referenced module.meta-arguments: It is a feature supported since Terraform 0.13. Similar to resource and data, it can be used to manipulate the behaviors of module. For more information, see MetaData.source argument tells Terraform where to find the source code for the desired child module. Terraform uses this during the module installation step of terraform init to download the source code to a directory on local disk so that it can be used by other Terraform commands.
The module can be installed from the following source types:module "consul" {source = "./consul"}
<NAMESPACE>/<NAME>/<PROVIDER>. You can get the exact source address in the module description. For example:module "consul" {source = "hashicorp/consul/xxx"version = "0.1.0"}
<HOSTNAME>/ to the source address header to specify the server name of the private repository. For example:module "consul" {source = "app.terraform.io/example-corp/k8s-cluster/azurerm"version = "1.1.0"}
github.com, it will automatically recognize it as a GitHub source. For example, you can clone a repository using the HTTPS protocol: module "consul" {source = "github.com/hashicorp/example"}
module "consul" {source = "git@github.com:hashicorp/example.git"}
ref argument in the same way. If you want to access private repositories, you need to configure additional Git credentials.version meta-argument to constrain the version of the module used. For example:module "consul" {source = "hashicorp/consul/xxx"version = "0.0.5"servers = 3}
version meta-argument is in line with the provider version constraint. In this case, Terraform will use the latest version of the module instance that has been installed. If no compliant version is currently installed, the latest compliant version will be downloaded.version meta-argument can only be used with the registry to support public or private module repositories. Other types of module sources, such as local path, do not necessarily support versioning.Feedback