tfr:/// prefix and pin a specific version. This approach simplifies version management and leverages the official Terraform Registry distribution.
Why Use the Terraform Registry?
| Source Type | Prefix | Example Address |
|---|---|---|
| GitHub | git::https://github.com/... | git::https://github.com/terraform-aws-modules/terraform-aws-s3-bucket.git |
| Terraform Registry | tfr:/// | tfr:///terraform-aws-modules/s3-bucket/aws?version=4.1.2 |
Pinning module versions (e.g.
?version=4.1.2) ensures reproducible builds and prevents unexpected changes when upstream modules are updated.terragrunt.hcl Configuration
Create or update yourterragrunt.hcl file with the registry source and input variables:
tfr:///— Registry prefix (two slashes for delimiter + one slash to start address).namespace/module_name/provider— Module path on the Terraform Registry.?version=x.y.z— Query parameter to lock the module version.
Initialize and Apply with Terragrunt
Run the following commands to download the module and provision your S3 bucket:Verify the S3 Bucket
Use the AWS CLI to confirm that your bucket exists:Bucket names must be globally unique. If you encounter an error about the bucket already existing, choose a different name.