# KodeKloud: Courses Terragrunt for Beginners ## Terragrunt for Beginners ### Introduction - [Course: Terragrunt for Beginners](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/index.md): This course teaches managing infrastructure as code with Terragrunt, focusing on best practices for a DRY and scalable Terraform workflow. - [Course Introduction](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Introduction/Course-Introduction/page.md): This course teaches managing infrastructure as code with Terragrunt, focusing on best practices for a DRY and scalable Terraform workflow. - [Introduction to Terragrunt](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Introduction/Introduction-to-Terragrunt/page.md): This article introduces Infrastructure as Code, Terraform, and Terragrunt, focusing on their benefits and how to streamline workflows. ### Terragrunt - Good to Know Concepts & Ideas - [TerraformOpenTofu and Terragrunt Compatibility Chart](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Good-to-Know-Concepts-Ideas/TerraformOpenTofu-and-Terragrunt-Compatibility-Chart/page.md): Compatibility between Terragrunt and Terraform/OpenTofu versions is essential for effective infrastructure automation and to avoid errors. - [Terragrunt Cache](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Good-to-Know-Concepts-Ideas/Terragrunt-Cache/page.md): This article explains how Terragrunts cache works and provides best practices for managing it effectively. - [Terragrunt With AWS](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Good-to-Know-Concepts-Ideas/Terragrunt-With-AWS/page.md): This guide explains integrating Terragrunt with AWS for efficient infrastructure management, covering provider setup, remote state, IAM roles, and best practices. ### Terragrunt Configuration - [Terragrunt Configuration Files HCL](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Configuration/Terragrunt-Configuration-Files-HCL/page.md): This guide dissects the core of Terragrunt, focusing on the `terragrunt.hcl` configuration file to enhance infrastructure as code workflows. - [Directory Structure](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Configuration/Directory-Structure/page.md): A well-organized directory layout simplifies management of Terraform configurations with Terragrunt, promotes reuse, and makes environment-specific customizations straightforward. - [Supporting Files accountregionenvcommonhcl](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Configuration/Supporting-Files-accountregionenvcommonhcl/page.md): Centralizing account, region, environment, and common HCL files to reuse configuration and improve maintainability in Terragrunt repositories - [Global Resources](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Configuration/Global-Resources/page.md): This article explains how to organize global AWS services in Terragrunt-based Terraform repositories for clarity and efficiency. ### Terragrunt Commands - [terragrunt init and validate](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Commands/terragrunt-init-and-validate/page.md): This article explores the functionality and practical use of `terragrunt init` and `terragrunt validate` commands in streamlining Terraform workflows. - [terragrunt plan](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Commands/terragrunt-plan/page.md): Generates and reviews execution plans for Terraform infrastructure changes, enhancing visibility and efficiency across configurations. - [terragrunt apply](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Commands/terragrunt-apply/page.md): This article explains the `terragrunt apply` command for automating infrastructure changes with Terragrunt and Terraform, detailing its execution and best practices. - [terragrunt destroy](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Commands/terragrunt-destroy/page.md): The article explains the `terragrunt destroy` command for safely deprovisioning Terraform-managed infrastructure and maintaining consistent environments. - [terragrunt run all](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Commands/terragrunt-run-all/page.md): The command enables bulk Terraform operations across all project modules, automating workflows and ensuring consistency in large-scale deployments. - [terragrunt hclfmt](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Commands/terragrunt-hclfmt/page.md): Terragrunt HCL Format enforces consistent style for HCL files, helping teams maintain clean code and minimize version-control noise. - [Demo of Lab 2](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Commands/Demo-of-Lab-2/page.md): This lesson covers authenticating to AWS, inspecting Terragrunt configuration, and deploying a VPC module using Terragrunt. ### Terragrunt Functions - [Terragrunt Function Overview](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Functions/Terragrunt-Function-Overview/page.md): Overview of core Terragrunt functions to enhance modularity, maintainability, and dynamic configuration in infrastructure design. - [read terragrunt config](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Functions/read-terragrunt-config/page.md): This lesson explores Terragrunts `read_terragrunt_config` function for reading HCL files and returning their contents as a map. - [find in parent folders](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Functions/find-in-parent-folders/page.md): This article explains how to use Terragrunt’s `find_in_parent_folders` function for recursive file searches in project directories. - [path relative to include](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Functions/path-relative-to-include/page.md): This lesson explores Terragrunt’s `path_relative_to_include` function for calculating relative paths in configuration files. - [get terragrunt dir](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Functions/get-terragrunt-dir/page.md): The `get_terragrunt_dir()` function returns the absolute path of the directory containing the current `terragrunt.hcl` configuration for dynamic file references. - [get parent terragrunt dir](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Functions/get-parent-terragrunt-dir/page.md): This article explains the `get_parent_terragrunt_dir()` function for managing hierarchical configurations in Terragrunt by returning the parent directory path. - [run cmd](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Functions/run-cmd/page.md): Terragrunt’s run_cmd is an interpolation function that executes shell commands during a run and returns their standard output. - [Other Terragrunt Functions](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Functions/Other-Terragrunt-Functions/page.md): Terragrunt offers built-in utilities to streamline configurations, reduce repetition, and integrate with AWS and other environments. ### Terragrunt Blocks - [Terragrunt Blocks Overview](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Blocks/Terragrunt-Blocks-Overview/page.md): This article provides an overview of the seven core Terragrunt configuration blocks for enhancing Terraform workflows. - [terraform Block](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Blocks/terraform-Block/page.md): The article explains the Terraform block in Terragrunt, detailing its attributes and how to configure it for consistent Terraform behavior. - [remote state Block](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Blocks/remote-state-Block/page.md): Terragrunt’s remote_state block centralizes Terraform state storage by configuring remote backends, ensuring consistency, locking, and encryption across environments and teams. - [include Block](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Blocks/include-Block/page.md): The Include Block in Terragrunt allows integration of external HCL files, enhancing reusability and consistency in infrastructure configurations. - [locals Block](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Blocks/locals-Block/page.md): Learn to use the locals block in Terragrunt for defining reusable variables and expressions to simplify configuration and improve maintainability. - [dependency Block](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Blocks/dependency-Block/page.md): The Terragrunt dependency block allows module dependencies, enhancing modular infrastructure, code reuse, and inter-module communication. - [dependencies Block](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Blocks/dependencies-Block/page.md): The dependencies block in Terragrunt ensures modules are applied in a specific order by listing prerequisite module paths. - [generate Block](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Blocks/generate-Block/page.md): The generate block in Terragrunt automates file creation, enhancing consistency and simplifying management of Terraform configurations across multiple modules. - [Demo of Lab 3](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Blocks/Demo-of-Lab-3/page.md): Learn to structure Terragrunt configurations for multi-module AWS deployment, provisioning VPC, EC2 instances, and managing remote state with Terraform and Terragrunt. ### Terragrunt Attributes - [Terragrunt Attribute Overview](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/Terragrunt-Attribute-Overview/page.md): This guide explores key Terragrunt configuration attributes for advanced control over Infrastructure as Code workflows. - [inputs Attribute](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/inputs-Attribute/page.md): Terragrunt’s inputs attribute is essential for passing configuration values into Terraform modules using key-value pairs for modular and maintainable infrastructure code. - [download dir Attribute](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/download-dir-Attribute/page.md): This article explains the download_dir attribute in Terragrunt for managing Terraform module source caching. - [prevent destroy Attribute](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/prevent-destroy-Attribute/page.md): This article explains the `prevent_destroy` attribute in Terragrunt to protect critical infrastructure from accidental deletion. - [skip Attribute](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/skip-Attribute/page.md): This article explores the `skip` attribute in Terragrunt, a boolean flag for controlling module execution of Terraform commands. - [iam role And Related Attributes](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/iam-role-And-Related-Attributes/page.md): This lesson explores Terragrunt’s iam_role attribute for assuming AWS IAM roles, enhancing security and credential management in Terraform commands. - [terraform binary Attribute](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/terraform-binary-Attribute/page.md): Terragrunt’s terraform_binary attribute allows specifying a custom Terraform executable for consistent version control across environments and projects. - [terraformterragrunt version constraint Attribute](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/terraformterragrunt-version-constraint-Attribute/page.md): Learn to enforce Terraform and Terragrunt version constraints in your configuration to ensure consistency and avoid unexpected upgrades. - [retryable errors Attribute](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/retryable-errors-Attribute/page.md): This article explains the `retryable_errors` attribute in Terragrunt for automatically retrying Terraform commands on transient errors. - [Demo of Lab 4](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Attributes/Demo-of-Lab-4/page.md): This article guides configuring Terragrunt to deploy and manage an AWS VPC module with best practices for security and efficiency. ### Managing Remote State with Terragrunt - [Remote State in Terraform](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Managing-Remote-State-with-Terragrunt/Remote-State-in-Terraform/page.md): This article explains configuring remote state in Terraform using Terragrunt for centralized management of state files and highlights best practices and popular backends. - [Configuring Remote State With Terragrunt Using AWS S3](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Managing-Remote-State-with-Terragrunt/Configuring-Remote-State-With-Terragrunt-Using-AWS-S3/page.md): This guide explains how to use Amazon S3 and Terragrunt for managing Terraform remote state efficiently. - [DynamoDB as a Locking Mechanism](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Managing-Remote-State-with-Terragrunt/DynamoDB-as-a-Locking-Mechanism/page.md): This article discusses using AWS DynamoDB for state locking in Terraform and Terragrunt to prevent deployment conflicts and ensure serialized state modifications. - [Setting up DynamoDB Locks](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Managing-Remote-State-with-Terragrunt/Setting-up-DynamoDB-Locks/page.md): This article explains how to set up DynamoDB locks using Terraform and Terragrunt for managing state file consistency in Infrastructure as Code workflows. - [Demo of Lab 5](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Managing-Remote-State-with-Terragrunt/Demo-of-Lab-5/page.md): This lab teaches configuring a remote state backend and AWS provider using Terragrunt to manage infrastructure in AWS. ### Terragrunt Modules - [Custom Modules vs Community Modules](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Custom-Modules-vs-Community-Modules/page.md): This article explores the benefits and trade-offs of using Community modules versus building Custom modules in Terraform. - [Creating Your Own Module From Scratch](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Creating-Your-Own-Module-From-Scratch/page.md): This guide covers creating a reusable Terraform module, including structure, input declarations, resource definitions, outputs, examples, versioning, and documentation. - [Demo Creating Your Own Module From Scratch](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Demo-Creating-Your-Own-Module-From-Scratch/page.md): This tutorial teaches how to build a reusable Terraform module for an AWS S3 bucket and consume it with Terragrunt. - [Sourcing a Module From a Git Repository](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Sourcing-a-Module-From-a-Git-Repository/page.md): Learn to reference Terraform modules in a private Git repository and manage authentication securely for reproducible Terraform runs. - [Demo Sourcing a Module From a Git Repository](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Demo-Sourcing-a-Module-From-a-Git-Repository/page.md): This tutorial teaches how to source a Terraform module from GitHub using Terragrunt for consistent deployments. - [Sourcing a Module From the Terraform Registry](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Sourcing-a-Module-From-the-Terraform-Registry/page.md): Learn to source and manage Terraform modules using Terragrunt for efficient infrastructure as code practices. - [Demo Sourcing a Module From the Terraform Registry](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Demo-Sourcing-a-Module-From-the-Terraform-Registry/page.md): This guide demonstrates sourcing an S3 bucket module from the Terraform Registry using Terragrunt for simplified version management. - [Hybrid Module Approach](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Hybrid-Module-Approach/page.md): This article discusses the Hybrid Module Approach in Terraform, blending community and custom modules for efficient infrastructure management. - [Wrapper Module Approach](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Wrapper-Module-Approach/page.md): This article discusses the wrapper module approach in Terraform for enforcing organizational standards while reusing community modules. - [Demo Wrapper Module Approach](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Demo-Wrapper-Module-Approach/page.md): This article explains how to create a wrapper module for the Terraform S3 bucket module to enforce naming conventions and configuration rules. - [Section Closure](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Modules/Section-Closure/page.md): Mickey's journey with Terragrunt enhances his understanding of infrastructure as code through structured configuration and music, leading to production-grade environments. ### Building our first AWS Demo with Terragrunt - [Section Introduction](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Building-our-first-AWS-Demo-with-Terragrunt/Section-Introduction/page.md): This lesson combines Terragrunt and AWS to build a sample project demonstrating infrastructure-as-code concepts with a fully deployed AWS demo. - [Root Configuration and Remote State](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Building-our-first-AWS-Demo-with-Terragrunt/Root-Configuration-and-Remote-State/page.md): This guide explains how to centralize Terraform state and streamline provider configuration using Terragrunt. - [Setting Up Account Regions and Environments](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Building-our-first-AWS-Demo-with-Terragrunt/Setting-Up-Account-Regions-and-Environments/page.md): This guide explains organizing Terragrunt configurations for AWS infrastructure into layers for consistency, scalability, and maintenance across multiple accounts and regions. - [Setting Up the First Group of Resources VPC](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Building-our-first-AWS-Demo-with-Terragrunt/Setting-Up-the-First-Group-of-Resources-VPC/page.md): Provision a reusable AWS VPC across environments using the terraform-aws-modules VPC module with Terragrunt, environment-specific inputs, and recommended init plan apply workflow. - [Setting Up the Second Group of Resources Security Groups Key Pairs](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Building-our-first-AWS-Demo-with-Terragrunt/Setting-Up-the-Second-Group-of-Resources-Security-Groups-Key-Pairs/page.md): Deploying AWS Security Groups and Key Pairs using Terraform modules and Terragrunt for secure infrastructure management. - [Setting Up the Third Group of Resources EC2](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Building-our-first-AWS-Demo-with-Terragrunt/Setting-Up-the-Third-Group-of-Resources-EC2/page.md): Provisioning reusable Terraform EC2 module and Terragrunt environment configurations to deploy and manage EC2 instances across dev and prod with best practices and deployment steps - [Demo of Lab 6](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Building-our-first-AWS-Demo-with-Terragrunt/Demo-of-Lab-6/page.md): This article provides a walkthrough for using Terragrunt to provision a multi-account, multi-region AWS infrastructure. ### Conclusion - [Story Conclusion](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Conclusion/Story-Conclusion/page.md): Mickey discovers how Terragrunt enhances his infrastructure workflow through environment replication, module reuse, and multi-account promotion, making his daily tasks easier and more efficient. - [Where to from here Useful Resources Guides and Suggestions](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Conclusion/Where-to-from-here-Useful-Resources-Guides-and-Suggestions/page.md): Explore resources and best practices to enhance your Terragrunt knowledge and engage with the community for continuous learning and support. - [Outro Video](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Conclusion/Outro-Video/page.md): This article summarizes the completion of a Terragrunt course, highlighting key takeaways and next steps for advancing Infrastructure as Code skills. ### Terragrunt - Basic Concepts - [What Is Terragrunt](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Basic-Concepts/What-Is-Terragrunt/page.md): Terragrunt is a wrapper for Terraform that enhances Infrastructure as Code workflows by improving management of complex infrastructures with less repetition. - [What Problems Does Terragrunt Solve](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Basic-Concepts/What-Problems-Does-Terragrunt-Solve/page.md): Terragrunt enhances Terraform by managing complexity, centralizing state, eliminating duplication, and maintaining consistency across environments for better team collaboration. - [The DRY Principle](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Basic-Concepts/The-DRY-Principle/page.md): This article explains the DRY principle in Terragrunt for Terraform, focusing on modular configurations, variable abstraction, and hierarchical inheritance. - [Installing Terragrunt](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Basic-Concepts/Installing-Terragrunt/page.md): Learn how to install Terragrunt on Windows, macOS, and Linux to streamline your Terraform workflows. - [Demo of Lab 1](https://notes.kodekloud.com/docs/Terragrunt-for-Beginners/Terragrunt-Basic-Concepts/Demo-of-Lab-1/page.md): This lesson guides you through installing Terraform 1.8.3 and Terragrunt 0.58.8 in your cloud shell and formatting your code.