Terraform and Infrastructure as Code

This is a start on Terraform operations against AWS to fulfill the thought of Infrastructure as Code

The best thing is, you can provision your server using command in parallel, quick, elegant and happily. And beyond that, if you make this one in a predictable way, think for a while, how much money you can save… Oh, my gosh!

So it has most of the features I desired for a tool to provision a server:

  • Infrastructure as Code
  • Execution Plans
  • Resource Graph
  • Change Automation

So, basically I want a tool to provision a server in a reliable and simple way. Better with Dependency graph feature, which is essentially the DAG.

So here is Terraform. Let’s start.

1. Basic Introduction

One sentence to describe Terraform: provision your infrastructure in a desired sequence of components dependencies.

1.1. Basic Concept

  • Provider: Providers generally are an IaaS (e.g. AWS, GCP, Microsoft Azure, OpenStack), PaaS (e.g. Heroku), or SaaS services (e.g. Terraform Enterprise, DNSimple, CloudFlare). A provider is responsible for creating and managing resources.
  • Resource: A resource might be a physical component such as an EC2 instance, or it can be a logical resource such as a Heroku application, which is inside a infrastructure, comes from a provider.

1.2. Basic Commands

  • terraform init: init the local settings for next commands, eg. install the provider plugins
  • terraform apply: shows the execution plan in a Git-like format with + or -, and wait for approval for execution
  • terraform show: inspect the current state in terraform.tfstate file
0%