What is Terraform? Why do we need to learn Terraform?

As we approach the end of 2018, it is a good opportunity to reflect on the past year. Those days are not anymore when we need to wait for weeks and months to provision a bare metal server for our application. It does take a lot of time to configure and get them up and running, but in this fast moving world, there is no time for us to wait. In this competitive era, companies want to succeed sooner by implementing cutting-edge solutions. What we need is to have a configuration management tool that automates the creation of our infrastructure.
What if we can configure an immutable infrastructure with less of the efforts and saving up time?



In this intelligent and cloud-obsessed and virtual world, all companies use infrastructure as code (IAC) to spin up servers or instances, be it in AWS, GCP, or OpenStack. The popular tools available are
Chef
Ansible
Puppet
Terraform
The million dollars worth question that comes to your mind: with a cornucopia of tools available, which tool to choose to provision or configure my infrastructure?
Undoubtedly, you are searching the right one, which minimizes risks, avoids human error and efforts… I hope my thoughts on using Terraform for infrastructure
configuration will help you get rid of the confusion.
WHY TERRAFORM :
Here are the reasons to choose terraform over other tools :
 Terraform is an “orchestration” tool, not an “automation tool:” Automation is a task which does not need human intervention, while on another side what  Orchestration means is, taking several tasks and creating a workflow, or running several automated tasks called as processes. For example, the orchestration is a way of combining multiple automation tasks to create creating a security group or IP.
 Terraform is “Declarative” not “Procedural/Imperative:”  Declarative programming style does not control the flow of the program, you just need to mention what you want and not how to do it. In procedural programming, on the other hand, you define the whole process and mention the steps how to do it.
For example, if you want to deploy three OpenStack instances to run an app, here is the sample code Ansible template using a procedural approach:
 name: launch a compute instance
hosts: localhost
tasks:
  - name: launch an OS instance
    os_server:
      state: present
      region_name: region-b.geo-1
      image: CentOS-7.0
      image_exclude: deprecated
      flavor_ram: 4096
      count: 3


And here  is another example using Terraform’s declarative approach:
resource "openstack_compute_instance_v2" "basic" {
count           = 5
image_id        = "a12we-5ftrg"
flavor_id       = "3"
key_pair        = "my_key_pair_name"
security_groups = ["default"]
Yes, the two approaches look quite indistinguishable. But only when you initially execute them with Terraform or Ansible.
Now, it’s peak load for your server; consider you want to increase your instance count to 20. With Ansible code, if you just change count value to 20 and rerun, it will deploy 20 new servers and create 25 in total. Holy Moly!! Was that needed? Instead, if rerun by opting the Terraform code after changing your count, it will only create an additional 10 servers, making the total count 20. This is because, with declarative programming, you need to declare the end state that you want. The declarative method in Terraform always represents the latest state of your infrastructure. Amazing, isn’t it?
Terraform follows Client Only Architecture, not Client/Server Architecture: Chef, Ansible, Puppet all follow client/server architecture. You issue commands on a
client machine and it executes your commands and stores the state of your machine. The server talks to agents, which must installed on every instance that you want to
configure.  Contrary Terraform uses the cloud provider API’s to configure your infrastructure.
 Terraform has Multi-Provider Support: Terraform supports different cloud providers like Google, AWS, Open Stack, Azure. It allows you to write code specific to
each provider.
Terraform gives Immutable Infrastructure: This means once you instantiate your server, you need not change it. Instead, instances are redeployed, restored from
previous versions. Components are replaced rather than being updated with newer enhancements.

Terraform is a powerful tool when used by an individual, but when groups of people collaborate using Terraform, they can achieve real, transformational benefits from
IAC.

To learn Terraform or get hands-on experience on Terraform please contact us @ training@itlearn360.com or contact us @ 800-543-5571

Comments

Popular posts from this blog

How To Learn Data Science In 8 Easy Steps

Top 5 IT career options for NON-IT candidates

Why IT Certifications are Important to Launch Your Tech Career