What is Terraform? How to install Terraform? Terraform Commands

What is Terraform                            Terraform is an open-source Infrastructure as a code(IAC) tool, it was developed and managed by...


What is Terraform

                           Terraform is an open-source Infrastructure as a code(IAC) tool, it was developed and managed by Hashicorp. 

                           Terraform has automated the provisioning, configuring, managing of the infrastructure. Mainly it is used for provisioning the infrastructure. can deploy the apps.

                           Terraform defines and provides the complete infrastructure using an easy-to-learn declarative language Hashicorp configuration language(HCL).

                           Terraform's main advantage was supporting multiple cloud providers such as AWS, Azure, Google Cloud, Kubernetes, Oracle cloud.


Why do we need to terraform?

                           Terraform is basically a server orchestration tool. So it will mostly concentrate on the server provisioning with the software container deployment tools like docker and packer.

                           It is an immutable Infrastructure, so it identifies the issues by utilizing the immutable infrastructure approach to create the separate configuration snapshots, using this method development environment goes smoothly and completely workable.

                           It is a Declarative Code style so that terraform prefers describing the desired state of the system and the tool itself reaching the goal state, terraform orders the tool to do the current active state of the system. It has a small code base, easily understandable.

                           Terraform is a client-only architecture, It leverages the cloud providers API to 

Provisioning the infrastructure, which removes the need for an additional security check, running a separate configuration management server, multiple software agents, ansible does this by connecting through the SSL, yet the capability is limited.


Benefits of Terraform:

                           Easy, quick to create an infrastructure in multiple clouds.

                           Flexibility to launch the infrastructure, when theory needed.

                           Reduce the time to push the code in production using automation.

                          Automated the backups of the database


How to install Terraform?

                          Download the latest version of the file from the terraform website.

It has multiple operating systems such as Windows,macOS, Linux, OpenBSD, FreeBSD, Solaris.

                          In our case, we are going to install the terraform in the RHEL Linux machine. 

the Terraform website itself providing the installation steps for Linux.


Repository configuration:

Before installing the terraform need to install add the required repo in the machine, here we are using RHEL, so using the Yum package manager, add the repo using the yum-config-manager.

Command: sudo yum install -y yum-utils Command: sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/$release/hashicorp.repo


The above command in the $relase we need to given the Linux distributions.

For Redhat Enterprise Linux: RHEL

For Fedora Linux: fedora 

For Amazon Linux: AmazonLinux


Here, we are using RHEL so below command we are going to use

  Command: sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo

Now we are ready to install terraform using the below command

 Command: yum install terraform

After the installation, verify the version using the below command
 Command:terraform -v
So we are successfully installed the terraform, Terraform has some commands listed below.

Terraform commands:

Terraform CLI the basic five commands everyone need to know 

 1. init            - Initialize the working directory consist of all the configuration files

 2. validate    - Check whether the configuration is valid

 3. plan          - Show changes required by the current configuration

 4. apply        - It applies then makes the changes in the infrastructure as defined in the plan, comes to the desired state.

 5. destroy     - Destroy previously-created infrastructure

Other than four terraform had some other commands also listed below 

 6. console       -Try Terraform expressions at an interactive command prompt

 7. fmt               -Reformat your configuration in the standard style

 8. force-unlock -Release a stuck lock on the current workspace

 9. get               -Install or upgrade remote Terraform modules

 10.graph         -Generate a Graphviz graph of the steps in an operation

 11. import        -Associate existing infrastructure with a Terraform resource

 12.login           -Obtain and save credentials for a remote host

 13.logout         -Remove locally-stored credentials for a remote host

 14.output         -Show output values from your root module

 15.providers    -Show the providers required for this configuration

 16.refresh        -Update the state to match remote systems

 17.show           -Show the current state or a saved plan

 18.state           -Advanced state management

 19.taint            -Mark a resource instance as not fully functional

 20.untaint        -Remove the 'tainted' state from a resource instance

 21.version       -Show the current Terraform version

 22.workspace  -Workspace management


In the next blog, will see the Terraform Working flow, using the terraform to provisioning the servers in the AWS.



COMMENTS

Name

AWS,2,Devops,15,linux,9,
ltr
item
Techie View: What is Terraform? How to install Terraform? Terraform Commands
What is Terraform? How to install Terraform? Terraform Commands
https://1.bp.blogspot.com/-_zQ_ncCg51o/YMeaMrlL_GI/AAAAAAAAAUk/3f4AiuuficU16nXN3rGP11fBxU8czQoUgCLcBGAsYHQ/s320/Terraform.png
https://1.bp.blogspot.com/-_zQ_ncCg51o/YMeaMrlL_GI/AAAAAAAAAUk/3f4AiuuficU16nXN3rGP11fBxU8czQoUgCLcBGAsYHQ/s72-c/Terraform.png
Techie View
https://www.techiev.com/2021/06/what-is-terraform-how-to-install.html
https://www.techiev.com/
https://www.techiev.com/
https://www.techiev.com/2021/06/what-is-terraform-how-to-install.html
true
7013663511659419322
UTF-8
Loaded All Posts Not found any posts VIEW ALL View Full Article Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy