Giter Club home page Giter Club logo

dev-vpc's Introduction

README

Description

This repo is intended to setup and configure a VPC environment for High Availability. Below is a description of what the terraform code will stand up, and how to go about deploying it. This will be a little different than the way applications will be deployed simply because it is the networking infrastructure that application instances will be deployed to.

What you'll need:

Steps terraform will take:

  • Create VPC
  • Create 2 External Subnets
  • Create 2 Internal Subnets
  • Create AWS NAT Gateway
  • Create 2 EIP's and Associate with NAT Gateway

Deploy Terraform Stack

  • Create S3 Bucket to store terraform .tfstate file
$ vi create_s3_bucket.sh
      s3_bucket='terraform-builds'
      profile='development'

$ ./create_s3_bucket.sh
  • Create VPC Environment with terraform

There is an extra step when deploying the VPC with terraform since there is currently no networking infrastructure stood up yet. Follow the steps below to stand up the Networking infrastructure.

Modify the remote.tf file with appropriate settings. This will only need to be done when standing up the VPC. Application deployment should not need this.

terraform {
  backend "s3" {
    bucket = "mybucket-builds"
    key    = "dev-vpc/dev-vpc.tfstate"
    region = "us-east-1"
  }
}

Modify variables.tf. This is the 'goto' file for managing your input variables. I've explained a bit in detail with comments.

variable "global" {
  type = "map"
  default = {

    ## Name Tagging
    app_name      = "dev-vpc"   # keep this the repo name for consistency
    vpc_name      = "vpc"       # name of your vpc
    env           = "dev"       # the name of your environment
    subnets_name  = "subnet"    # the name of your subnets

    ## Region
    region       = "us-west-1"              # the region you want to deploy to
    azs         = "us-west-1a,us-west-1c"   # the availability zones. (make sure they are available in AWS first)
    ami_id      = "ami-73f7da13"            # the AMI image you want to use for your ec2 instances

    ## Networking
    vpc_cidr    = "10.0.0.0/16"                 # your VPC CIDR (Can leave alone)
    subnets_ext  = "10.0.10.0/24,10.0.11.0/24"  # your External Subnet Ranges (add more with a ",")
    subnets_int  = "10.0.20.0/24,10.0.21.0/24"  # your Internal Subnet Ranges (add more with a ",")

    ## tfstate info
    bucket_name = "mycompany-builds"    # the name of your bucket to store .tfstate files. 
                                          # this will create a sub directory of ${app_name}
  }
}

Run terraform commands to stand up the VPC infrastructure

$ terraform init
$ terraform plan -out=create.tfplan
$ terraform show create.tfplan
$ terraform apply create.tfplan

Destroy Terraform Stack

Run terraform commands to stand up the VPC infrastructure

$ terraform init
$ terraform plan -destroy -out=destroy.tfplan
$ terraform show destroy.tfplan
$ terraform apply destroy.tfplan

dev-vpc's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.