Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform AWS EC2 Module Project

This Terraform project demonstrates the use of modules to create and manage AWS EC2 instances across different environments (development, staging, and production).

Project Structure

├── main.tf                 # Main Terraform configuration file
├── terraform.tfvars        # Variable definitions for the project
├── modules/
│   └── ec2_instances/     # EC2 instance module
│       ├── main.tf        # Module main configuration
│       └── variables.tf    # Module variable definitions
└── terraform.tfstate.d/   # State files for different environments
    ├── dev/
    ├── prod/
    └── stage/

Features

  • Modular design for reusable EC2 instance configurations
  • Support for multiple environments (dev, stage, prod)
  • Centralized variable management through terraform.tfvars

Prerequisites

  • AWS CLI configured with appropriate credentials
  • Terraform installed (version 0.12 or later)
  • Basic understanding of AWS EC2 service

Usage

  1. Initialize Terraform:
terraform init
  1. Select workspace for your environment:
terraform workspace select dev    # For development
terraform workspace select stage  # For staging
terraform workspace select prod   # For production
  1. Review the planned changes:
terraform plan
  1. Apply the configuration:
terraform apply

Module Configuration

The EC2 instance module can be configured through variables in terraform.tfvars. Example configuration:

instance_type = "t2.micro"
ami_id        = "ami-xxxxx"

State Management

This project uses local state files organized by environment in the terraform.tfstate.d directory. Each environment (dev, stage, prod) maintains its own state file.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Maintainer

rxnjitth

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages