This repository contains multiple practice projects and Terraform configuration files to automate and manage infrastructure on AWS. Each folder represents a different Terraform topic, exercise, or task, progressing from basic to more advanced concepts like EC2 instances, S3 buckets, modules, provisioners, and clusters.
- Basic Terraform script to create an EC2 instance and S3 bucket.
- Demonstrates the foundational skills of launching resources using Terraform.
- Terraform configuration to create an EC2 instance using variables.
- Shows how to make infrastructure more dynamic by defining and using variables.
- Creates a custom VPC with subnets, route tables, and a gateway.
- Learn how to configure your own network in AWS using Terraform.
- Configures a remote backend for storing Terraform state files.
- Important for collaboration and tracking infrastructure state.
- Creates an S3 bucket for storing the Terraform state file.
- Shows the process of keeping state files secure and centralized.
- Introduces the lifecycle rules in Terraform to manage resources.
- Learn how to control resource creation, updates, and destruction.
- Demonstrates how to set dependencies between resources in Terraform.
- Ensures that resources are created in the correct order.
- Uses multiple providers within a single Terraform configuration.
- Learn to manage infrastructure in different regions or clouds.
- Implements reusable Terraform modules.
- Shows how to organize and reuse code efficiently.
- Creates an EC2 instance with a new SSH key pair for secure access.
- Configures EC2 instances using user data scripts.
- Automates software installation and configuration during instance launch.
- Practice using provisioners to run scripts on EC2 instances.
- Helps in bootstrapping instances with required configurations.
- Demonstrates the
count
feature to create multiple instances of a resource.
- Use of local values in Terraform for cleaner, more maintainable code.
- Demonstrates the
for_each
meta-argument to loop through resources dynamically.
- Targets a specific resource in Terraform to apply changes to that resource only.
- Experimenting with null resources and local provisioners for custom workflows.
- Cluster creation: Set up a new cluster, demonstrating advanced Terraform usage.
- Updates and changes to the base
terraform.tf
files.
-
Clone the repository:
git clone https://github.com/dibakarpatro/Terraform-cloud-automation.git
-
Navigate to the directory of the day/topic you want to practice:
cd day01_create_ec2&s3
-
Initialize Terraform:
terraform init
-
Run a Terraform plan to see the infrastructure changes:
terraform plan
-
Apply the Terraform configuration to deploy infrastructure:
terraform apply
-
Destroy resources once you're done:
terraform destroy
- Make sure you have AWS credentials configured for Terraform to interact with your AWS account.
- Each day or folder contains its own separate configuration file and infrastructure setup.
- Some folders, like
something_new
, contain more complex examples such as cluster setups.
- Terraform
- AWS account with proper IAM permissions.
Dibakar Patro
This repository serves as a learning tool and documentation for various Terraform practices on AWS.