Skip to main content
In this guide, we’ll demonstrate how to source the same S3 bucket module from the Terraform Registry using Terragrunt. Instead of pulling the module from GitHub, we switch to the tfr:/// prefix and pin a specific version. This approach simplifies version management and leverages the official Terraform Registry distribution.

Why Use the Terraform Registry?

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 your terragrunt.hcl file with the registry source and input variables:
The syntax breakdown:
  • 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.

Watch Video