crackyourinterview.com


Article for Terraform


Total Visit:-67

What is Terraform, How it Works and Why to Use

Terraform Working and Definition




What is Terraform

Well Terraform is an IaC (Infrastructure as Code) tool which mainly helps you to Build, Change, Version cloud(version example GitHub etc.) and On-Prem resources safely and efficiently.
Above is short definiton for "What Terraform is" now we goes on some more detail on Terraform. HashiCorp Terraform is an IaC tool which lets you define both the cloud and on-prem resources in human-readable config files which can be reuse, share and version later on as per the requirements. And you can use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. And one another userful thing about the Terraform is that you can manage both low-level and high-level components. And when we say about low-level components means like compute, storage and the networking resources. And when we say about the high-level components like DNS entries and SaaS features.



How does Terraform work?


As from above definition we knows that Terraform create and manage resources on cloud platforms and some other services through their application programming interfaces (APIs). Providers enable Terraform to work with virtually any platform or service with and accessible API.



HashiCorp and the Terraform community have already written thousands of providers to mainly manage many different types of resources and services. You can find all the providers available on the Terraform Registry which includes AWS, GCP (Google CLoud Platform), Azure, Helm, GitHub, Splunk, DataDog, Azure and many more.

And when we say about the core Terraform workflow this will consist of three main stages:-

(1)Write:-You define resources which may be across multiple cloud providers and the services. And to understand this we will take a example, here you will create a configuration to deploy an application on virtual machines in a VPC (Virtual Private CLoud) network with secuirty groups and a load balancer.

(2)Plan:-Well Terraform will creates an execution plan which describe the infrastructure and this will create, update or destroy based on the existing infrastructure and your configuration.

(3)Approval:-On approval the Terraform will performs the proposed operations in the correct order, respecting the any resource dependencies. And to understand this will will take a example of VPC. If you update the properties of a VPC and change the number of virutal machine in that VPC, here Terraform will recreate the VPC before scaling the virtual machines.





Why to Use Terraform?


Below are the 5 main reason why to use Terraform:-

(1)Manage any Infrastructure
You can find all publicly available providers on the Terraform Registry, including Amazon Web Services (AWS), Azure, Google Cloud Platform (GCP), Kubernetes etc. And even you can create your own. Terraform will takes an immutable approach to infrastructure. This will also helps in reducing the complexity of upgrading or modifying your services and infrastructure.

(2)Track your infrastructure
Here Tereaform will generate a plan which will prompts you for approval before you modifying your infrastructure. This will keeps track of your real infrastrcuture in a state file, which acts as a source of truth for your environment. And Terraform mainly use this state file to determine the changes to make to infrastructure so that this will match your configuration.

(3)Automate Changes
Terraform configuration files are declarative and theu will describe the end state of your infrastructure. And now you need not to write step-by-step instrcutions to create resources because Terraform handles the underlying logic. Terraform will builds a resource graph to determine resource dependencies and creates or modifies non-dependent resources in parallel. And this will allows Terraform to provision resources efficiently.

(4)Standardize configurations
Terraform supports resuable configuration components which are called modules whihc define configurable collections of infrastructure, saving time and encouraging best practices. You can use publicly available modules from the Terraform Registry, or write your own.

(5)Collaborate
As all of your configuration is written in a file, you can commit it to a VCS (Version COntrol System) and use HCP Terraform to efficiently manage Terraform workflows across teams. HCP Terraform runs Terraform in a consistent, reliable environment and provides secure access to shared state and secret data, role-based access controls, a private registry for sharing both modules and providers, and more.



Other Important Questions

Article Topic Create a Docker Container Image with each step guide
Article Topic Proc and Cons of Docker for self hosting
Article Topic Docker Container Create with example?



























@2014-2024 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap