module source
The source argument of a module block, which says where to get the module: a local path such as ./modules/network, the registry, or a Git address.
In more detail
Local paths are for modules in the same repository and are read directly, so the version argument is not allowed. Registry sources accept a version constraint. To pin a module kept in Git, use a tag in the source address.
Examples
source = "./modules/network"source = "git::https://example.com/network.git?ref=v1.2.0"Related terms
- Terraform module — A directory of Terraform files with inputs (variables) and outputs, which other configurations can call to reuse the same infrastructure design.
- public module — A reusable module published to the Terraform Registry, called by an address such as terraform-aws-modules/vpc/aws.
- git tag — A name fixed permanently to one commit, usually to mark a release such as v1.0, and the command that creates and lists them.
Taught in
- Calling Your Module And Passing Variables — Infrastructure as Code with Terraform
- The Terraform Registry And Public Modules — Infrastructure as Code with Terraform
- Versioning And Pinning Modules — Infrastructure as Code with Terraform
- One Hour, No Weights Published — HashiCorp Terraform Associate (004) Exam Prep
- Write, Plan, Apply, And What Init Prepares — HashiCorp Terraform Associate (004) Exam Prep
- Where Modules Come From — HashiCorp Terraform Associate (004) Exam Prep
- Module Versions: Pin, Upgrade, Re-Initialise — HashiCorp Terraform Associate (004) Exam Prep