Skip to content

tjrohweder/terraform-aws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 

Repository files navigation

Terraform — Environments (dev and prod) with VPC + EKS

This project contains infrastructure defined using Terraform, organized into two independent environments: dev and prod. Each environment creates its own VPC and EKS cluster.

Project Structure

.
├── .gitignore
├── README.md
└── envs
    ├── dev
    │   ├── backend.tf
    │   ├── locals.tf
    │   ├── main.tf
    │   ├── terraform.tfvars
    │   └── variables.tf
    └── prod
        ├── backend.tf
        ├── locals.tf
        ├── main.tf
        ├── terraform.tfvars
        └── variables.tf

Environments

Each folder under envs/ represents an isolated Terraform environment:

dev/ → Development infrastructure

prod/ → Production infrastructure

Authentication

Generate AWS credentials and export them as variables

export AWS_ACCESS_KEY_ID="access_key"
export AWS_SECRET_ACCESS_KEY="secret_key"
export AWS_DEFAULT_REGION="us-east-1"

Backend Configuration

The backend.tf file in each environment contains a placeholder bucket name for storing the Terraform state.

You must replace the placeholder with your actual bucket:

terraform {
  backend "s3" {
    bucket = "<YourBucketName>-terraform-tfstate"
    key    = "terraform.tfstate"
    region = "us-east-1"
  }
}

How to Use

Go into the environment you want to deploy (dev or prod):

  1. Initialize Terraform
terraform init --upgrade
  1. Validate configuration
terraform validate
  1. Check code formatting
terraform fmt -check -diff
  1. Preview execution plan
terraform plan
  1. Apply changes
terraform apply

About

Terraform scripts for AWS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages