This repository is a comprehensive document of my personal learning path with Terraform. It's a hands-on collection of experiments, core concepts, design patterns, and real-world Infrastructure as Code (IaC) projects, primarily focused on AWS cloud automation.
The goal of this repository is to systematically learn and demonstrate various Terraform functionalities, from the basics of code syntax and state management to advanced topics like modules, provisioners, and multi-cloud/multi-account setups. Each numbered directory represents a key concept explored in depth.
To run the configurations in this repository, you'll need the following installed and configured:
- Terraform CLI
- AWS Account and AWS CLI (with configured credentials).
git
The repository is structured into sequential folders to follow a logical learning progression.
| Section | Folders | Topics Covered |
|---|---|---|
| I. Fundamentals | Basic-Code | Basic HCL syntax, resources, and providers. |
| terraform-setup-files | Working with variables, outputs, and local files. |
|
| terraform-statefile | Understanding and managing the local state file. |
|
| state-locking | Implementing remote backend (like S3/DynamoDB) to prevent concurrent state modifications. |
|
| II. Core Concepts | Custom-Networking, Target-resources, lifecycle-rules | Custom Networking, lifecycle rules, and targeting specific resources. |
| import | Importing existing cloud resources into Terraform state. | |
| modules | Creating and consuming reusable infrastructure modules. | |
| Provisioners | Using local-exec and remote-exec to execute scripts. |
|
| III. Advanced Topics | Workspace, locals, multi-account, multiple-provider, taint | Workspace management, locals for expressions, taint command, IAM, multi-account, and multiple provider configurations. |
| IV. Resource Examples | RDS | Deploying a managed Relational Database Service. |
| lambda | Automating the deployment of AWS Lambda functions. | |
| IAM | Created a custom VPC network, attached an IAM role to an EC2 instance, and configured it with the CloudWatch Agent for monitoring using user data and null resource block. |
- Clone the repository:
git clone https://github.com/Swinalwaghmare/Terraform-journey.git cd Terraform-journey - Navigate to a specific concept folder:
cd [07]-modules # or cd Project/3-Tier-Project
- Initialize Terraform:
terraform init
- Review the execution plan:
terraform plan
- Apply the configuration:
terraform apply
- Clean up resources (when done):
terraform destroy
The Project/3-Tier-Project directory contains a comprehensive example of a real-world architecture.
This project demonstrates deploying a complete application stack, typically consisting of:
- Presentation Tier: Load Balancer and Auto Scaling Group for web servers.
- Application Tier: Private subnets for application servers.
- Data Tier: Private subnets for a managed database (like RDS).
- Configured VPC, Subnets, Route Tables, and Security Groups for secure networking.