If you want to effectively deploy your infrastructure on cloud using Terraform, you’ll need an effective Terraform tutorial. Terraform is revolutionizing the way organizations think of Infrastructure as Code, as well as DevOps. But, learning a new language can seem like an uphill battle if you’re late to the game. And, as DevOps organizations continue to decide to adopt it, diving into a strong Terraform tutorial can help you learn quickly and efficiently. Note: This article is intended for beginners.

Many DevOps trends have included Infrastructure as Code as areas to watch in 2020, and we’re not seeing any slowing of growth in these areas. In fact, training and learning are ranked as high-priority for DevOps organizations. With over 55% of organizations looking to hire internally, acquiring the skillset for changing organizations is a necessity. Of course, there’s an abundance of information online about Terraform, but where do you begin? In this article, we’re looking at the must-know information to get started, as well as other resources you can consider as you continue to learn. In addition, we encourage you to join our InfraCode Slack to gain more DevOps resources and 1-on-1 help.

In this article, we’ll go over resources for you to get started, including:

  • Terraform Tutorial Basics: What is it?
  • What are the commands to deploy infrastructure
  • Configuration Overview
  • Other Resources

Let’s dive in.

Terraform Tutorial Basics: What is it?

Any useful Terraform tutorial starts with the question: “What is it?” So, let’s begin our resource list with the answer to this question.

Terraform is an open-source tool that is specifically dedicated to creating, modifying, and even deleting infrastructure on cloud, focusing on “Infrastructure as Code.” Users who attempt to build their infrastructure use a declarative language known as HashiCorp Configuration Language (HCL).

You may also wonder “what is Infrastructure as Code?” Infrastructure as Code (IaC) is the management of infrastructure in a descriptive model, where the same source code generates the same binary. An Infrastructure as Code model generates the same environment every time it is applied. For a more in-depth Terraform tutorial (going over the basics), check out HashiCorp’s introduction.

If you’re a newcomer, it’s also important to know that like all other products, there are version-by- version releases. The latest version available is 0.14. However, any version from 0.12 is considered good enough for you to download and have a hands-on Terraform tutorial.

What are the commands to deploy infrastructure?

Everything is controlled by a Command Line Interface (CLI) with very simple-to-remember commands. For a complete list of commands, bookmark this page.

A Terraform tutorial will refer to the following as the most-used commands:

  • Init
  • Plan
  • Apply
  • Destroy

**Init: **When you have all your terraform configuration files ready in a directory, the “init” command can be used to initialize your working directories. Note that there is no restriction on how many times you may initialize the working directory, so you can use the command as many times as you’d like. However, remember to initialize your working directory every time you make a change to the configuration file.

Usage: terraform init [options] [DIR]

**Plan: **The “plan” command is used to set up an execution plan. It conveniently helps you to determine the actions that would be required to move to the state defined in your configuration file. What makes this command useful? It does not make changes to the real-world state but helps you see if the changes are up to your expectations and as per the configuration file. In other words, the “plan” command is your guide in setting up a strong structure to execute on.

Usage: terraform plan [options] [DIR]

**Apply: **The “apply” command is used to apply the changes to the current state to reach the desired state as per your configuration file. You may either use the command to scan the current configuration directory to apply the changes or you may specify the path to another directory where you have the configuration files. Note that confirmation is prompted when you use the command, to apply the changes.

Usage: terraform apply [options] [DIR-or-PLAN]

Destroy: Any infrastructure that has been set up can be destroyed or terminated by using the command “destroy.” Note that this command prompts your confirmation before terminating the infrastructure.

Usage: terraform destroy [options] [DIR]

#terraform #programming #developer

Terraform Tutorial Guides: An Overview
2.20 GEEK