Skip to content

This project focuses on utilizing Infrastructure as Code (IaC) tools like Terraform, Pulumi, and AWS CloudFormation to automate and manage cloud infrastructure. The goal is to create reusable, efficient, and scalable modules while ensuring best practices in IaC implementation.

Notifications You must be signed in to change notification settings

Randul-Malinhara/terraform-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Infrastructure as Code (IaC) Project

Overview

This project focuses on utilizing Infrastructure as Code (IaC) tools like Terraform, Pulumi, and AWS CloudFormation to automate and manage cloud infrastructure. The goal is to create reusable, efficient, and scalable modules while ensuring best practices in IaC implementation.


Objectives

  • Develop expertise in Terraform, Pulumi, and AWS CloudFormation.
  • Create reusable modules or plugins for these tools to enhance efficiency.
  • Automate infrastructure deployment and integrate it with CI/CD pipelines.

Project Structure

1. Terraform

Directory: terraform-project/
Contains reusable Terraform modules and configurations.

Structure:

terraform-project/
├── main.tf
├── variables.tf
├── outputs.tf
├── modules/
    └── ec2/
        ├── main.tf
        ├── variables.tf
        └── outputs.tf

2. Pulumi

Directory: pulumi-project/
Contains Pulumi scripts written in Python to define and deploy infrastructure.

Structure:

pulumi-project/
├── __main__.py

3. AWS CloudFormation

Directory: cloudformation-project/
Contains AWS CloudFormation templates for infrastructure as YAML files.

Structure:

cloudformation-project/
├── template.yaml

Getting Started

Prerequisites

  1. Install Tools:
  2. Configure AWS Credentials:
    aws configure

Steps to Run

Terraform

  1. Navigate to the Terraform project directory:
    cd terraform-project
  2. Initialize Terraform:
    terraform init
  3. Validate and plan:
    terraform validate
    terraform plan
  4. Apply the changes:
    terraform apply

Pulumi

  1. Navigate to the Pulumi project directory:
    cd pulumi-project
  2. Install dependencies:
    pip install pulumi pulumi-aws
  3. Preview the stack:
    pulumi preview
  4. Deploy the stack:
    pulumi up

CloudFormation

  1. Navigate to the CloudFormation project directory:
    cd cloudformation-project
  2. Deploy the template:
    aws cloudformation deploy --template-file template.yaml --stack-name my-stack

Features

  • Reusability: Modular design for EC2 instances and other components.
  • Multi-language Support: Pulumi scripts leverage Python, enabling more flexibility.
  • Automation: GitHub Actions workflow for CI/CD integration.

Testing and Validation

  • Terraform: terraform validate, terraform plan
  • Pulumi: pulumi preview, pulumi up
  • CloudFormation: aws cloudformation validate-template

CI/CD Integration

Example: Terraform CI Workflow

name: Terraform CI
on:
  push:
    branches:
      - main
jobs:
  terraform:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Set up Terraform
        uses: hashicorp/setup-terraform@v2
      - name: Terraform Init
        run: terraform init
      - name: Terraform Plan
        run: terraform plan

Deliverables

  1. Terraform project in terraform-project/
  2. Pulumi project in pulumi-project/
  3. CloudFormation project in cloudformation-project/

Success Criteria

  • Reusability: Scripts can be used for multiple environments.
  • Scalability: Infrastructure accommodates increasing demand.
  • Automation: CI/CD pipelines ensure rapid deployment.
  • Documentation: Clear instructions for usage and modification.

About

This project focuses on utilizing Infrastructure as Code (IaC) tools like Terraform, Pulumi, and AWS CloudFormation to automate and manage cloud infrastructure. The goal is to create reusable, efficient, and scalable modules while ensuring best practices in IaC implementation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published