Lets Get Started with Terraform

Terraform is an open source tool that allows you to define infrastructure for a variety of cloud providers (e.g. AWS, Azure, Google Cloud, DigitalOcean, etc) using a simple, declarative programming language and to deploy and manage that infrastructure using a few CLI commands.

Why we use IAS in mostly all the software companies ?

  • fear of downtime
  • fear of accidental misconfiguration
  • fear of slow and fragile deployments, and fear of what would happen if the sysadmins fell to the dark side (i.e. took a vacation)

Advantages:

  • automate entire process which is more reliable and fast as compare to manual process.
  • store source files which has the infrastructure stage and anyone can read and understand it.
  • store infrastructure code in version control which makes easier for commit logs, rollback, code reviews and automated tests
  • You can create reusable, documented, battle-tested infrastructure packages that make it easier to scale and evolve your infrastructure.
  • Happy developers

before getting into why terraform and their benefits lets discuss few basics things. If you search for IAC tools on google you will get lots of tools like chef, ansible, puppet, cloudFormation, terraform backed by huge community support.

Now question is which one is better ?

End goal of all IAC tools will going to be same, but when you start comparing tools which fulfil your same need at the end of day then you start thinking in terms of trade-offs and priorities.

So below are some trade-offs and priorities for choosing IAC tools:

  • Configuration Management vs Orchestration
    • configuration management is like you have a server and you want to provision it.
    • Orchestration is like you have to provision your own server.
  • Mutable Infrastructure vs Immutable Infrastructure
    • Chef, Puppet, Ansible, and SaltStack typically default to a mutable infrastructure paradigm. If you tell chef to install a new version of VIM, it will run the software update on existing server and the changes will be happen in-place. Over the time as you apply new changes to VIM each server will have its own history of changes. This often leads to a phenomenon known as configuration drift, where each server becomes slightly different than all the others, leading to subtle configuration bugs that are difficult to diagnose and nearly impossible to reproduce.
  • Procedural vs Declarative
    • Precedural: Like chef and ansible you just have to defile all setup to provision any server
    • Declarative: Like terraform you have to define what you need and let terraform figure out how to achieve required result.
  • Client/Server Architecture vs Client-Only Architecture
    • Client/Server Architecture: Like chef
    • Client-Only Architecture: Like ansible and terraform

For more details: https://blog.gruntwork.io/why-we-use-terraform-and-not-chef-puppet-ansible-saltstack-or-cloudformation-7989dad2865c

Now we are in a state of defining why we chose terraform, Lets dig deeper into it

Why Terraform ?

As we discussed above like about trade-offs and priorities, choosing terraform came form that discussion.

An Introduction to terraform:

We’ll walk you through the entire process, step-by-step:

  1. Set up your AWS account
  2. Install Terraform
  3. Deploy a single server
  4. Deploy a single web server
  5. Deploy a cluster of web servers
  6. Deploy a load balancer
  7. Clean up

REferences:

To Be Continued …

Leave a comment