GETTING STARTED WITH TERRAFORM (PART-1)

Updated: Aug 9, 2020






INTRODUCTION


Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.

Configuration files describe to Terraform the components needed to run a single application or your entire data center. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied.



KEY FEATURES OF TERRAFORM

Infrastructure as Code

Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your data center to be versioned and treated as you would any other code. Additionally, infrastructure can be shared and re-used.

Execution Plans

Terraform has a "planning" step where it generates an execution plan. The execution plan shows what Terraform will do when you call apply. This lets you avoid any surprises when Terraform manipulates infrastructure.


Resource Graph

Terraform builds a graph of all your resources, and parallelize the creation and modification of any non-dependent resources. Because of this, Terraform builds infrastructure as efficiently as possible, and operators get insight into dependencies in their infrastructure.


Change Automation

Complex changesets can be applied to your infrastructure with minimal human interaction. With the previously mentioned execution plan and resource graph, you know exactly what Terraform will change and in what order, avoiding many possible human errors.



CREATE A FREE TIER AWS ACCOUNT


In this series of tutorials, we are going to work with Terraform on AWS. Every practical will be based on the creation of infrastructure with Terraform. Though terraform supports multiple cloud platforms, we are going to practice on AWS. For this let's create an AWS account.

  • For this go to the link and create an account. CLICK HERE

  • After the account has been created, create an IAM user with admin access on the AWS account. We are giving full admin access because using its access keys we will create AWS infra using terraform.

  • For this Go to AWS console –> Go to Services –> Go to IAM Service


  • Click on Users Add User


  • Give Username – Give Programmatic as well as console access


  • Grant admin access to the user “terraform”, for this first create a group.


  • Create the group – You can skip adding tags – Now move forward to create user

Download the key pair and save it. This is the key pair we will use to work with Terraform.



TERRAFORM INSTALLATION


  • Terraform can be installed on a variety of operating systems, we will work on CentOS 7

  • To download the setup and install terraform, follow the below steps.

  • Log in to a Linux box with root user and create a directory

mkdir /root/terraform-lab
cd /root/terraform-lab
yum install epel-release -y
yum install wget unzip -y
unzip terraform_0.12.28_linux_amd64.zip
mv terraform /usr/local/bin/



Alright, people, we are all set to get our hands dirty on Terraform. We will dig in more in future articles. Happy learning :)





3,162 views4 comments

Recent Posts

See All
 

Subscribe Form

©2020 by Linux Advise