Skip to content

N333l/Modular-infrastructure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Modular Infrastructure

This repository contains a modular Infrastructure as Code (IaC) setup using Terraform. It provisions a clean, segregated AWS environment using custom modules and community modules.

Repository Structure

The repository is logically divided into reusable modules and distinct environments:

  • modules/: Contains reusable templates.
    • vpc: Wraps the official Terraform AWS VPC module to spin up secure networks across availability zones.
    • iam: Provisions IAM Users, automatically adds them to shared IAM Groups, sets up passwords, and attaches policies.
    • ec2: Fetches the latest Amazon Linux 2023 AMI dynamically and deploys an EC2 instance into our VPC.
  • environments/: Contains environment-specific configurations that consume the modules.
    • dev: Configuration isolated for development traffic.
    • prod: Configuration isolated for production traffic.

Getting Started

Prerequisites

  • Terraform >= 1.0.0
  • An AWS Account

Setup

  1. Clone this repository down to your local machine.
  2. Navigate to your desired environment (e.g., cd environments/dev).
  3. Create a backend configuration or variables file. We use terraform.tfvars. Because this file often contains sensitive access keys, it is ignored by Git by default. Create a terraform.tfvars visually similar to this:
    aws_region     = "us-east-1"
    aws_access_key = "YOUR_AWS_ACCESS_KEY"
    aws_secret_key = "YOUR_AWS_SECRET_KEY"

Execution

Use the standard Terraform workflow to launch the environment:

# 1. Initialize the provider and remote modules
terraform init

# 2. Validate syntactic correctness
terraform validate

# 3. Preview your infrastructure before deployment
terraform plan

# 4. Deploy!
terraform apply

To clean up and avoid AWS charges:

terraform destroy

Security Note

The .gitignore has been strictly formatted to ignore terraform.tfstate files, .terraform caching directories, and *.tfvars variable inputs to maintain a secure repository cleanly. Never commit your IAM access and secret keys.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages