Code Monkey home page Code Monkey logo

my_terraform_templates's Introduction

terraform-aws-vpc

Name convention

il y a un fichier par module. La convention de nommage est : provider_resource.tf

This goal of this project is to easily spin up an Amazon Web Services (AWS) Virtual Private Cloud (VPC) using Terraform.

Configuration

The project root contains a file named terraform.tfvars.example. Rename that file to terraform.tfvars and populate it with your AWS credentials:

$ mv terraform.tfvars.example terraform.tfvars
$ vim terraform.tfvars

There is also a variables.tf at the project root. It contains a listing of all the Terraform variables. Some defaults are set there as well. If you want to override any of them, override them in terraform.tfvars.

Usage

All of the interactions with Terraform are wrapped in a Makefile. It contains targets for planning, applying, and destroying changes to your AWS infrastructure.

Plan

The plan phase takes your Terraform configuration and attempts to provide you with a plan of what it would do if you applied it. It outputs an execution plan to stdout along a terraform.tfplan file (not human-readable).

$ make plan
Refreshing Terraform state prior to plan...

The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed.

Your plan was also saved to the path below. Call the "apply" subcommand
with this plan file and Terraform will exactly execute this execution
plan.

Path: terraform.tfplan

Apply

The apply phase simply takes the Terraform execution plan and attempts to execute it. It outputs its progress to stdout along a terraform.tfstate file (not human-readable).

$ make apply
aws_vpc.default: Creating...
  cidr_block: "" => "10.0.0.0/16"
aws_vpc.default: Creation complete

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.

State path: terraform.tfstate

Destroy

The destroy phase happens in two steps. First, Terraform generates a destroy execution plan, and then applies it. It outputs an execution plan to stdout along a new terraform.tfplan file. After that, it attempts to apply the destroy execution plan.

$ make destroy
Refreshing Terraform state prior to plan...

aws_vpc.default: Refreshing state... (ID: vpc-20bf1d45)

The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed.

Your plan was also saved to the path below. Call the "apply" subcommand
with this plan file and Terraform will exactly execute this execution
plan.

Path: terraform.tfplan

- aws_vpc.default


aws_vpc.default: Destroying...
aws_vpc.default: Destruction complete

Apply complete! Resources: 0 added, 0 changed, 1 destroyed.

Note: The destroy step usually has to be run more than once because of an issue with deleting the Elastic IP (EIP) before it is unbound from the NAT instance. Run make destroy again after the failure to complete the destroy phase. TODO: describe

Refresh

$ make refresh
### Status
```bash
$ make destroy

my_terraform_templates's People

Contributors

cchaudier avatar hectcastro avatar

Watchers

James Cloos avatar

Forkers

jacko972

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.