Prerequisites
- Terragrunt installed (v0.XX+).
- AWS CLI configured with valid credentials.
- Git installed and reachable from your environment.
terragrunt.hcl
Create or update yourterragrunt.hcl file:
Appending
?ref=v4.1.2 to the Git URL locks the module to version 4.1.2. This prevents unexpected changes due to upstream updates.Module Inputs
| Input | Description | Required | Default |
|---|---|---|---|
| bucket | Name of the S3 bucket. | yes | — |
Apply the Configuration
Run the following command in the directory containing yourterragrunt.hcl:
yes and wait for provisioning to complete.
Verify the Bucket
After Terragrunt finishes, list your S3 buckets:terragrunt-demo-bucket in the list.
Sourcing from Private Repositories
If your module resides in a private Git repo, update thesource URL to point to your private repository (HTTPS or SSH) and ensure authentication is set up:
- SSH: Configure SSH keys and add them to your Git provider.
- HTTPS: Use
git-credential-helperor environment variables for credentials.
Do not store credentials in version control. Use secure credential helpers or environment variables to manage access.
Links and References
| Resource | URL |
|---|---|
| Terraform AWS S3 Module | https://github.com/terraform-aws-modules/terraform-aws-s3-bucket |
| Terragrunt Documentation | https://terragrunt.gruntwork.io/docs/ |
| Terraform Documentation | https://www.terraform.io/docs/ |
| AWS CLI | https://aws.amazon.com/cli/ |