1. Verify Your Terraform Version
First, confirm the Terraform CLI version installed on your system:2. Auto-Generate AWS Provider Files with Terragrunt
All Terragrunt configuration lives under your Terraform stack directory (terraform-stack/terragrunt.hcl). We’ll generate three files:
2.1 Generate providers.tf
Add this block to terragrunt.hcl to configure AWS in us-east-1:
2.2 Generate versions.tf
Next, pin to the latest major AWS provider release:
Ensure your
terragrunt.hcl includes these generate blocks before initializing.3. Initialize Terragrunt
Switch into your Terraform stack directory and run initialization:providers.tf and versions.tf created automatically.
4. Configure Remote State in S3
An S3 bucket namedkk-infra-state-<random> already exists for your Terraform state. Discover its exact name:
terragrunt.hcl with this block to generate backend.tf:
Never commit your AWS access keys or state files to version control.