tfr:// protocol.
1. Referencing a Module in Terragrunt
In yourterragrunt.hcl file, set the source attribute to point at a Registry module:
| Element | Description | Example |
|---|---|---|
| namespace | Author or organization publishing the module | terraform-aws-modules |
| module_name | Identifier for the module | vpc |
| provider | Cloud provider name | aws |
2. Initializing the Configuration
Run the following command to download and prepare the module in your working directory:3. Pinning a Module Version
To guarantee reproducible builds and avoid unintended upgrades, specify a version constraint:~> 3.0 ensures you get all non-breaking updates in the 3.x series.
4. Updating to the Latest Matching Version
When you’re ready to pull in the newest matching release (within your version constraint), use:5. Security and Best Practices
Always verify the module’s publisher and review its source code before applying in production. Prefer modules marked as Verified or provided by official vendors to reduce risk.
- Review module inputs, outputs, and provisioners for security compliance.
- Check the Terraform Registry page for the module’s documentation and changelog.
- Use version pinning to control when features and fixes are introduced.