Code Monkey home page Code Monkey logo

terraform-starter-kit's Introduction

Terraform-Starter-Kit

The code here bootstraps an infrastructure from a single entrypoint, the ./do script. Firstly, Ansible creates a state bucket for Terraform, and then Terraform can be run layer-by-layer to provision any kind of infrastructure. It works locally as well as through Jenkins, so long as the Environment variables are defined.

For Terraform, the ./do script runs both headlessly and interactively. Interactively, the script will offer options based on the available environments, available layers, and the three Terraform commands, plan, apply and destroy.

Example

To build a bare bones infra consisting on a single VPC with a single private subnet, do the following once the dependencies are installed and the environment variables are present.

./do bootstrap # this creates the S3 bucket for the Terraform state
./do

# And interactively choose an env, then the first layer, 001_vpc
# Then 'plan' or 'apply'

This will plan or build the infrastructure. When finished, run ./do again, but choose to destroy. Then,

./do teardown

This will remove the cleanup the state bucket in S3.

Dependencies

Python 2.7
Ansible
AWS Cli
Boto
Terraform
Bash

Using direnv

Copy envrc.template to .envrc and fill in the appropriate details.

Add your own environment

Copy ./environments/999_example to a new directory under ./environments.

Prepare the system

Create the S3 bucket required for Terraform state management:

./do bootstrap

Run interactively

./do

And follow the prompts.

When finished, cleanup

./do teardown

This removes both the infra and then finally the S3 bucket for state management.

Run headlessly

Setup/teardown

./do bootstrap

And

./do teardown

Then, the format is:

./do <command> -e <env_name> -l <layer_name>

Where available commands are plan, apply and destroy.

./do plan -e 999_example -l 001_vpc

terraform-starter-kit's People

Contributors

vishvish avatar

Watchers

 avatar

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.