How to use Terraform (2023)

Last updated on May 27, 2022


OpenStack is an open source cloud operating system for building and managing public and private cloud computing platforms. The OpenStack software components form the basis of the OVHcloud public cloud infrastructure.

The open source tool Terraform was developed to facilitate the creation of complex cloud infrastructures. It allows abstracting the properties of your infrastructure into text files that can be used as a basis for deploying your infrastructure.

As an example, this video shows how you can easily scale the number of instances while keeping your existing infrastructure by changing just one line of code:

This guide explains how to use Terraform with the public cloud using practical examples.


This tutorial is compatible with Terraform version 0.14.0 and higher.


Creating the Terraform environment

After Terraform installation, create a directory for all text files describing your infrastructure:

mkdir test_terraform && cd test_terraform

You can now create a terraform environment with the following command. This allows you to create and manage the development of your infrastructure.

Terraform workspace new test_terraform

create resources

Creating a Provider

In Terraform, you specify "Provider" for your cloud environment. A "vendor" (like OVHcloud) hosts your OpenStack infrastructure resources.

Create a file namedAnbieter.tfwith the following content:

# Define vendors and set versionsTerraform {required_version = ">= 0.14.0" # Considers Terraform versions from 0.14.0 required_vendors { Openstack = { Those = "terraform-provider-openstack/openstack" execution = "~> 1.42.0" } oh = { Those = "ovh/ovh" execution = ">= 0.13.0" } }}# Configure the OpenStack provider hosted by OVHcloudOfferer "open stack" { auth_url = "" # Authentication URL domain name = "Originally" # Domain name - Always on "Default" for OVHcloud alias = "ohh" # An alias}Offerer "ohh" { alias = "ohh" end point = "ovh-eu" application key = "<your_access key>" application secret = "<your_application secret>" Consumer_key = "<your_consumer_key>"}

If you don't want to define your secrets in the Terraform configuration file, you can also define them in environment variables:

$ Export OVH_ENDPOINT=ovh-eu$ Export OVH_APPLICATION_KEY=Your_key_application_OVH(or_AK)$ Export OVH_APPLICATION_SECRET=Your_secret_application_key_OVH(or_AS)$ Export OVH_CONSUMER_KEY=your_token(or_CK)

The "alias" is a unique identifier for a provider. For example, if you have two OpenStack providers with different credentials, you need to specify each provider in the resource.

You must nowCreate a new OpenStack user, thenGenerate the OpenRC filewith any credentials you want to export as environment variables.

Load this file and then enter the password for the previously created user:

$ Thoseopenrc.shPlease enter your OpenStack password:
(Video) Terraform explained in 15 mins | Terraform Tutorial for Beginners

You now need to initialize your workspace to download the provider plugins:


Create an instance

In Terraform, a "resource" is a component of your infrastructure. This can be an instance, a storage block provided by the OpenStack provider, or a network provided by the OVHcloud provider.

To create an instance you need at least:

  • An instance name
  • A picture
  • a taste
  • An SSH key

As an example, let's create a simple instanceDebian 10with the tastep1-2, and import an SSH key. Add the following lines to a file

# Create an SSH key pair resourceResource "openstack_compute_keypair_v2" "test_keypair" { Offerer = Openstack.oh # provider name declared in Name = "test_keypair" # Name of SSH key to use for creation public key = file("~/.ssh/") # Path to your previously generated SSH key}# Create the instanceResource "openstack_compute_instance_v2" "test_terraform_instance" { Name = "terraform_instance" # instance name Offerer = Openstack.oh # provider name image name = "Debian 10" # image name flavor name = "s1-2" # Instance type name # Name der openstack_compute_keypair_v2-Ressource namens keypair_test key pair = openstack_compute_keypair_v2.test_keypair.Name network { Name = "ext-net" # Adds the network component to reach your instance }}

To see what is being added/created/deleted in your infrastructure you can run:


You can enter the following command to import your SSH key and create your first instance:

apply terraform

The output should look like this:

$ terraform applyopenstack_compute_keypair_v2.test_keypair: Updating state... [id=test_keypair] Terraform used the selected providers to generate the following execution plan. Resource actions are denoted by the following icons: + createTerraform performs the following actions: # creates openstack_compute_instance_v2.test_terraform_instance + resource "openstack_compute_instance_v2" "test_terraform_instance" { + access_ip_v4 = (known after apply) + access_ip_v6 = (known after apply) + all_metadata = (known after apply) + all_tags = (known after apply) + availability_zone = (known after apply) + flavor_id = (known after apply) + flavor_name = "s1-2" + force_delete = false + id = (known after apply ) + image_id = (known after apply) + image_name = "Debian 10" + key_pair = "test_keypair" + name = "terraform_instance" + power_state = "active" + region = (known after apply) + security_groups = (known after apply) + stop_before_destroy = false + network { + access_network = false + fixed_ip_v4 = (known after apply) + fixed_ip_v6 = (known after apply) + floating_ip = (known after apply) + mac = (known after apply) + name = "Ext-Net " + port = (known after apply) + uuid = (known after apply) } }Plan: 1 to add, 0 to change, 0 to destroy. Do you want to perform these actions in the test_terraform workspace? Terraform performs the actions described above. Only "Yes" will be accepted for approval. Enter a value: yesopenstack_compute_instance_v2.test_terraform_instance: Creating...openstack_compute_instance_v2.test_terraform_instance: Still creating... [10 seconds elapsed]openstack_compute_instance_v2.test_terraform_instance: Still creating... [20 seconds elapsed]openstack_compute_instance_v2.test_terraform=completed Creation completed after 28 seconds = -xxxx-xxxx-xxxx-53c2cee0b0fd] Application completed! Resources: 1 added, 0 changed, 0 destroyed.

Sign up for the nowOVHcloud Customer Center, go toPublic cloudsection and clickinstances. As you can see, your compute instance is created with the name "terraform_instance".

Note that creating a second, identical instance withapply terraformwill not work.
Terraform only applies changes when it detects a difference in your configuration files or a new file.

Creating multiple instances

In this section, we will create an Ubuntu instance of the "s1-2" flavor in three different regions.

You can find all region names by checking this OVHcloud API endpoint:

For this example we will use the following OVHcloud regions:

(Video) Beginners Tutorial to Terraform with AWS

  • GRA11
  • SBG5
  • BHS5

You can create three resources named openstack_compute_instance_v2 and change the region parameter for each one. However, it can become difficult to manage files with a large number of identical resources.

A better method is to use the resource metaparameter called "count". This allows you to instruct Terraform to create the same resource multiple times.

To do this, we create a file In it, we first define a variable to hold the three regions, and then add an instance creation counter:

# Create a region variable containing the list of OVHcloud regions# It is used to iterate over different regions# start an instance on each of them. Variable "Region" { Typ = list Originally = ["GRA11", "SBG5", "BHS5"] }# Create an SSH key pair Resource "openstack_compute_keypair_v2" "test_keypair_all" { counting = Long(war.Region) Offerer = Openstack.oh # Specify provider name Name = "test_keypair_all" # SSH key name public key = file("~/.ssh/") # Your SSH key path Region = Element(war.Region, counting.Index) } # Create a resource in each region that is an OpenStack instance Resource "openstack_compute_instance_v2" "instances_in_all_regions" { # How often the resource is created # defined by the length of the list named region counting = Long(war.Region) Offerer = Openstack.oh # provider name Name = "terraform_instances" # instance name flavor name = "s1-2" # instance flavor image name = "Debian 10" # image name # element is a function that accesses the element at position # count.index of list var.region. It allows to iterate between regions Region = Element(war.Region, counting.Index) # Accesses the name of the openstack_compute_keypair_v2 resource variable named test_keypair key pair = Element(openstack_compute_keypair_v2.test_keypair_all.*.Name, counting.Index) network { Name = "ext-net" # Adds the public network to your instance } }

Review the changes you need to make to your infrastructure with the following command:


Apply your changes with the following command:

apply terraform

Terraform can create multiple instances using this method, but you can also use it to modify your current infrastructure.

Modifying an instance

In this example, we'll add a new storage volume to our first instance. Open and edit the file with the, then add the following lines:

# Create a resource for storageResource "openstack_blockstorage_volume_v2" "volume_to_add" { Name = "simple_volume" # Volume-Name size = 10 # Volume size in GB Offerer = Openstack.oh # provider name}# Attach the previously created volume to the instanceResource "openstack_compute_volume_attach_v2" "appropriate" { # ID of openstack_compute_instance_v2 resource named test_terraform_instance instance_id = openstack_compute_instance_v2.test_terraform_instance.I would # ID der Ressource openstack_blockstorage_volume_v2 namens volume_to_add volume_id = openstack_blockstorage_volume_v2.volume_to_add.I would}

Review the changes you need to make to your infrastructure with the following command:


Apply your changes with the following command:

apply terraform

Creating an instance on the OVHcloud network (vRack)

The Terraform OVHcloud plugin can manage private networks, private subnets, public cloud users and vRack attachments. In this part we will focus on network creation.

Create a filecreate_private_network_instance.tfand enter the following:

Variable "service name" { Originally = "OS_PROJECT_ID" # Replace with your service name / OS_PROJECT_ID value}Variable "Project_ID" { Originally = "OS_TENANT_ID" # Replace OS_TENANT_ID with your project tenant ID}Variable "Region" { Originally = "GRA11" # Replace with your region, for example with the OS_REGION_NAME environment variable}# Map cloud project to vRack Resource "ovh_vrack_cloudproject" "vcp" { service name = war.service name Project_ID = war.Project_ID} # Create a private network Resource "ovh_cloud_project_network_private" "Network" { service name = war.service name Name = "private network" # network name The region = [war.Region] Offerer = oh.oh # provider name vlan_id = 168 # VLAN ID for vRack depends on = [ovh_vrack_cloudproject.vcp] # Depends on how the vRack is mapped to the cloud project } # Create a subnet with the private network created earlier Resource "ovh_cloud_project_network_private_subnet" "subnet" { service name = war.service name # ID of ovh_cloud_network_private resource named network Network ID = would beginning = "" # First IP of the subnet End = "" # Last IP of the subnet network = "" # Subnet IP address location DHCP = Is correct # Enable DHCP Region = war.Region Offerer = oh.oh # provider name no_gateway = Is correct # No default gateway } # Create an instance with 2 network interfaces Resource "openstack_compute_instance_v2" "proxy_instance" { Offerer = Openstack.oh # provider name Name = "proxy_instance" # instance name image name = "Debian 10" # image name flavor name = "s1-2" # flavor name # Name der openstack_compute_keypair_v2-Ressource namens keypair_test key pair = openstack_compute_keypair_v2.test_keypair.Name # Add public and private network network { Name = "ext-net" } network { Name = } }

This instance creation is linked to theopenstack_compute_keypair_v2.test_keypairResource you created earlier in this guide.

(Video) Complete Terraform Course - From BEGINNER to PRO! (Learn Infrastructure as Code)

Review the changes you need to make to your infrastructure with the following command:


Apply your changes with the following command:

apply terraform

A new instance with a public and a private interface appears in your public cloud project.

Creating an infrastructure for a website

In this example we will create a basic website infrastructure using Terraform and the OVHcloud private network. The components created are:

  • a private network
  • a subnet
  • two instances, each with two network interfaces: the first public and the second private
  • an instance with a private interface and two additional disks

How to use Terraform (1)

Create a file namedsimple_web_site.tfand enter the following lines:

Variable my region { Originally = "SBG5" # Replace with the contents of the OS_REGION_NAME environment variable}# Create a private networkResource "ovh_cloud_project_network_private" "private network" { service name = war.service name Name = "Backend" # network name The region = [ region] Offerer = oh.oh # provider name vlan_id = 42 # vRack-VLAN-ID depends on = [ovh_vrack_cloudproject.vcp] # Depends on whether vRack is linked to the cloud project}# Create a private subnetResource "ovh_cloud_project_network_private_subnet" "private_subnet" { # ID for the ovh_cloud_network_private resource named private_network Network ID = ovh_cloud_project_network_private.private network.I would service name = war.service name Region = region network = "" # Subnetz-IP beginning = "" # First IP of the subnet End = "" # Last IP of the subnet DHCP = NOT CORRECT # Disable DHCP Offerer = oh.oh # provider name no_gateway = Is correct # No default gateway}# Check for the latest Archlinux imageData "openstack_images_image_v2" "archlinux" { Name = "Archlinux" # image name latest = Is correct # Restricts the search to the most recent Offerer = Openstack.oh # provider name}# List of possible private IP addresses for frontendsVariable "front_private_ip" { Typ = list(any) Originally = ["", ""]}# Create 2 instances with 2 network interfacesResource "openstack_compute_instance_v2" "Front" { counting = Long(war.front_private_ip) # Number of instances to create Offerer = Openstack.oh # provider name Name = "Front" # instance name key pair = openstack_compute_keypair_v2.test_keypair.Name flavor name = "s1-2" # Instance type name image_id = Data.openstack_images_image_v2.archlinux.I would # instance image id security groups = ["Originally"] # Adds the instance to the security group network { Name = "ext-net" # Public network interface name } network { # Private network interface name Name = ovh_cloud_project_network_private.private network.Name # IP address from the previously defined list fixed_ip_v4 = Element(war.front_private_ip, counting.Index) } depends on = [ovh_cloud_project_network_private_subnet.private_subnet] # Depends on the private network}# Create a connectable storage device for backup (volume)Resource "openstack_blockstorage_volume_v2" "fuse" { Name = "backup_disk" # Storage device name size = 10 # Size Offerer = Openstack.oh # provider name}# Create an instance with a network interface and a storage deviceResource "openstack_compute_instance_v2" "the back" { Offerer = Openstack.oh # provider name Name = "the back" # instance name key pair = openstack_compute_keypair_v2.test_keypair.Name flavor name = "s1-2" # Instance type name image_id = Data.openstack_images_image_v2.archlinux.I would # instance image id security groups = ["Originally"] # Adds the instance to the security group network { Name = ovh_cloud_project_network_private.private network.Name # Private network name fixed_ip_v4 = "" # Randomly chosen private IP address } # Bootable storage device with the operating system block_device { uuid = Data.openstack_images_image_v2.archlinux.I would # instance image id source type = "Bild" # source type target type = "local" # Target volume_size = 10 # Size boot_index = 0 # Boot order delete_on_termination = Is correct # The device will be deleted when the instance is deleted } # storage medium block_device { source type = "file" # source type target type = "Volume" # Target volume_size = 20 # Size boot_index = 1 # Boot order delete_on_termination = Is correct # The device will be deleted when the instance is deleted } # Previously created storage device block_device { uuid = openstack_blockstorage_volume_v2.fuse.I would # storage device ID source type = "Volume" # source type target type = "Volume" # Target boot_index = 2 # Boot order delete_on_termination = Is correct # The device will be deleted when the instance is deleted } depends on = [ovh_cloud_project_network_private_subnet.private_subnet] # Depends on the private network}

Review the changes you need to make to your infrastructure with the following command:


Apply your changes with the following command:

apply terraform

Create a public cloud project

You can also create an OVHcloud project directly as code from Terraform.

However, two conditions apply:

  • You must have at least 3 public cloud projects (note that there is a default limit of 3 projects. To increase this limit, please submit a request to our support teams)
  • You must have created a public cloud project in the last 3 months.

If any of these business rules are not met, you will receive the following error message:"Permission issues found: ChallengePaymentMethod".
In this case, the only solution is to use theOVHcloud Customer Centerto create a project.
You will then be asked to confirm that you are in fact the owner of the funds used on your account (this challenge depends on the funds and other parameters).

Please understand these rules and additional human steps have been introduced as extra security for customers who may have disclosed their OVHcloud credentials.
We will try to further improve these rules in the future to facilitate infra-as-code scenarios like this public cloud project as code scenario.

Create a file namedProjekt.tfand enter the following lines:

Data "ovh_order_cart" "Car" { ovh_subsidiary = "fr" designation = "Use the French OVH shopping cart by default"}Data "ovh_order_cart_product_plan" "Clouds" { cart_id = Data.ovh_order_cart.Car.I would price_capacity = "renew" Product = "Clouds" Plancode = "project.2018"}Resource "ovh_cloud_project" "Clouds" { ovh_subsidiary = Data.ovh_order_cart.Car.ovh_subsidiary designation = war.project description means of payment = "Loyalty" the plan { duration = Data.ovh_order_cart_product_plan.Clouds.selected_price.0.duration Plancode = Data.ovh_order_cart_product_plan.Clouds.Plancode pricing_mode = Data.ovh_order_cart_product_plan.Clouds.selected_price.0.pricing_mode }}
(Video) Terraform Course - Automate your AWS cloud infrastructure

Delete an infrastructure

To remove all resources created via Terraform, you can enter the following command:

destroy terraform

go further

Join our community of users

Did you find this guide helpful?

Please do not hesitate to make suggestions to improve this documentation.

Whether your feedback is about images, content, or structure, please share it so we can improve it together.

Your support requests will not be processed through this form. Please use the"Create ticket"the image.

Many Thanks. Your feedback has been received.

You might also be interested in these guides...

Project Management, Instances, and Storage Change the hostname of an instance

Project management, instances and storage Configuration of additional SSH keys

Project Management, Instances, and Storage Build a custom OpenStack image with Packer


How is Terraform used? ›

Terraform is an IAC tool, used primarily by DevOps teams to automate various infrastructure tasks. The provisioning of cloud resources, for instance, is one of the main use cases of Terraform. It's a cloud-agnostic, open-source provisioning tool written in the Go language and created by HashiCorp.

How do I use Terraform in DevOps? ›

You will examine the terraform file which helps you to provision the Azure Resources required to deploy PartsUnlimited website.
  1. Navigate to the project you created above using Azure DevOps Demo Generator.
  2. Select Repos. Switch to terraform branch. ...
  3. Select the file under the Terraform folder. Go through the code.
Sep 29, 2022

What is Terraform example? ›

Terraform automatically maps the given resource to the default provider identified by the resource's identifier. For example, the default provider for aws_instance is aws . This aws provider is currently configured to deploy a resource in a particular region.

Is Terraform difficult to learn? ›

The Terraform Associate is not a difficult exam but strongly relies on practical knowledge of Terraform. That's why this study course is 12+ hours – we've added many follow alongs and common edge cases that you will only experience in practice.

What programming language is Terraform? ›

Terraform is an open source tool created by HashiCorp and written in the Go programming language.

What is Terraform for dummies? ›

Terraform in a nutshell

In its most basic form, Terraform is an application that converts configuration files known as HCL (Hashicorp Configuration Language) into real world infrastructure, usually in Cloud providers such as AWS, Azure or Google Cloud Platform.

What is Terraform vs Docker? ›

Terraform is one of the most widely used automation and infrastructure as code (IaC) tools. Docker lets you containerize applications with light-weighted technology and security for quick application deployment. And with Terraform, managing infrastructures become more ideal than the manual process.

Is Terraform CI or CD? ›

Terraform can be fully operated via API, CLI, and UI, which allows organizations to easily integrate it into their existing CI/CD pipelines, IT service management interfaces, and version control system processes.

What are the three steps in Terraform? ›

The core Terraform workflow has three steps:
  1. Write - Author infrastructure as code.
  2. Plan - Preview changes before applying.
  3. Apply - Provision reproducible infrastructure.

Is Terraform a DevOps tool? ›

Terraform by HashiCorp is an open-source DevOps tool. It allows to build, manage, and define infrastructure across cloud providers. The Terraform tool, also called the Infrastructure Build tool, enables developers to create and modify infrastructure in a secure and efficient environment.

Is Python used in Terraform? ›

Finally, with the CDK support, programming languages such as Python and TypeScript can be used today. Additional language support for Javascript, Java, and C# could be used in the future. This enables Terraform to act as a common platform for infrastructure provisioning and lifecycle management.

Is Terraform a CI tool? ›

Terraform is an open source infrastructure as code tool by HashiCorp.

How can I learn Terraform fast? ›

10 Best Online Courses to learn Terraform in 2022
  1. Hashicorp Certified — Terraform Associate. ...
  2. Terraform for absolute beginners [Coursera Project] ...
  3. Terraform: From Beginner to Master with Examples in AWS [Educative] ...
  4. Deep Dive — Terraform By Ned Bellavance [Pluralsight] ...
  5. Learn DevOps: Infrastructure Automation With Terraform.

Where do I write Terraform code? ›

Terraform can create infrastructure across a wide variety of platforms, or what it calls providers, including AWS, Azure, Google Cloud, DigitalOcean, and many others. You can write Terraform code in just about any text editor.

Can a non coder learn Terraform? ›

No, you don't need any coding experience prior to learning terraform.

Where can I practice Terraform? ›

Terraform Labs brings you tutorials that help you get hands-on experience using Terraform, Kubernetes & Cloud. Here you will find complete documentation of labs and tutorials around Terraform CLI, Configuration Language, sub-commands, providers, Registry and much more..

Should I learn Terraform or Kubernetes first? ›

If you want to learn more about the infrastructure as code, you should start with some basics AWS, then terraform. If you want to learn more about how to deploy your app, you should learn some basics of docker then K8s. So, you can start with docker->K8s->Cloud"AWS"->Terrraform.

Why is Terraform so popular? ›

Terraform is important to its users because of the value it provides: one way Terraform offers value to its users is in its modules. Terraform modules are containers for multiple resources that are used together in a configuration. These modules provide an easy way to package and reuse common code.

What are the cons of Terraform? ›

Terraform: Advantages and disadvantages at a glance
Advantages of TerraformDisadvantages of Terraform
Uniform Syntax for Infrastructure as CodeNo automatic rollback function for incorrect changes to resources
Support of various cloud solutionsCollaboration and security features available only in expensive enterprise plans
4 more rows
Jun 21, 2019

Is Terraform a backend? ›

By default, Terraform uses a backend called local , which stores state as a local file on disk. You can also configure one of the built-in backends included in this documentation.

Is Terraform same as Jenkins? ›

Jenkins can be classified as a tool in the "Continuous Integration" category, while Terraform is grouped under "Infrastructure Build Tools". Some of the features offered by Jenkins are: Easy installation. Easy configuration.

What is Terraform vs Kubernetes? ›

In a DevOps environment, Terraform is an infrastructure-as-code (IaS) tool used to deploy cloud infrastructure, and Kubernetes is an orchestration tool used to manage containers. You can't compare the two as similar tools, but you can compare the benefits that they provide in development operations.

Is Terraform only for AWS? ›

Terraform has more than 100 cloud providers it serves. At Fairwinds we use Terraform for three - AWS, GCP, and Azure. The provider is what enables interfacing with the specific API and exposes whatever resource you have defined.

Should I Terraform or Ansible? ›

In terms of use cases, Terraform is preferable for containerized solutions deployed for provisioning software within a cloud platform. In comparison, Ansible helps users gain reasonable control over enterprise devices and explore methods for deploying underlying components.

Is Terraform code JSON? ›

Most Terraform configurations are written in the native Terraform language syntax, which is designed to be relatively easy for humans to read and update. Terraform also supports an alternative syntax that is JSON-compatible.

Can Terraform call an API? ›

Call APIs with Custom SDK Providers

Interact with APIs using Terraform providers. In these tutorials, use a provider as a bridge between Terraform and a target API. Then, extend Terraform by developing a custom Terraform provider based on the Terraform Plugin SDK. Create an account to track your progress.

What are the two main components of Terraform? ›

Terraform has two important components: Terraform Core and Terraform Plugins. Terraform Core oversees the reading and interpolation of resource plan executions, resource graphs, state management features and configuration files.

How do I run Terraform locally? ›

Run Terraform plan
  1. Navigate to your application infrastructure code - cd modernisation-platform-environments/terraform/environments/my-application.
  2. Run a Terraform init - terraform init.
  3. View the workspaces (you have different workspaces for your different environment accounts) - terraform workspace list.

What is Terraform lifecycle? ›

Every resource that is managed by Terraform has a lifecycle, this lifecycle contains three stages; Apply (Create), Update, and Destroy.

What is Terraform AWS used for? ›

Terraform is an open-source IaC software tool that provides a consistent command line interface (CLI) workflow to manage hundreds of cloud services. Terraform codifies cloud APIs into declarative configuration files.

Why Terraform instead of Ansible? ›

Terraform excels as a cloud infrastructure provisioning and deprovisioning tool with an IaC approach. It's a specific tool with a specific purpose. Ansible offers an all-purpose, cross-domain automation solution. Both have active open source communities and well-supported downstream commercial products.

Is Terraform a deployment tool? ›

Terraform is–generally speaking–a cloud resource deployment tool. The most common use case for Terraform is to manage the lifecycle of cloud or virtual resources.

Is Terraform a build tool? ›

Terraform is an infrastructure as code tool that lets you build, change, and version cloud and on-prem resources safely and efficiently.

Is there anything better than Terraform? ›

Here are some of the Terraform alternatives: Pulumi. AWS CloudFormation. Azure ARM Templates.

Is Terraform good for AWS? ›

Terraform is a powerful tool for provisioning, maintaining, and having useful versioning on the cloud infrastructure. Terraform can manage existing and popular solutions as well as on-premise applications as well. Why should we use CloudFormation? CloudFormation supports almost all the services on AWS.

How do you learn Terraform for beginners? ›

Learn the basics of Terraform in this step-by-step tutorial of how to deploy a cluster of web servers and a load balancer on AWS
  1. Set up your AWS account.
  2. Install Terraform.
  3. Deploy a single server.
  4. Deploy a single web server.
  5. Deploy a configurable web server.
  6. Deploy a cluster of web servers.
  7. Deploy a load balancer.
  8. Clean up.

How do you start a Terraform? ›

  1. Initialize Terraform Configuration.
  2. Create a Terraform Plan.
  3. Apply Terraform Configuration.
  4. Customize Terraform Configuration with Variables.
  5. Output Data from Terraform.
  6. Manage Terraform Versions.
  7. Lock and Upgrade Provider Versions.
  8. Target Resources.

What are Terraform commands? ›

Main commands: init Prepare your working directory for other commands validate Check whether the configuration is valid plan Show changes required by the current configuration apply Create or update infrastructure destroy Destroy previously-created infrastructure All other commands: console Try Terraform expressions at ...

Where to start learning Terraform? ›

10 Best Online Courses to learn Terraform in 2022
  • Hashicorp Certified — Terraform Associate. ...
  • Terraform for absolute beginners [Coursera Project] ...
  • Terraform: From Beginner to Master with Examples in AWS [Educative] ...
  • Deep Dive — Terraform By Ned Bellavance [Pluralsight] ...
  • Learn DevOps: Infrastructure Automation With Terraform.

What is Terraform in a nutshell? ›

Terraform in a nutshell

In its most basic form, Terraform is an application that converts configuration files known as HCL (Hashicorp Configuration Language) into real world infrastructure, usually in Cloud providers such as AWS, Azure or Google Cloud Platform.

What is required to learn Terraform? ›

Prerequisites for this Terraform Training Course

Solid grasp of cloud fundamentals and some experience creating services in a public cloud (AWS, GCP, Azure, Oracle, etc.) Prior experience writing automation scripts (PowerShell, Bash, Python, etc.) is not required, but will make certain labs much easier.

What is the easiest place to Terraform? ›

While Venus, Earth, Mars, and even the Moon have been studied in relation to the subject, Mars is usually considered to be the most likely candidate for terraforming.

Can you run Terraform locally? ›

Whilst it is possible to see the results of a Terraform plan when you create a pull request, it is also possible to run a Terraform plan locally. Some engineers prefer this as it provides a quicker feedback loop to identify any issues with your infrastructure code.

How do I deploy an application in Terraform? ›

Terraform requires three steps for deployment:
  1. Initializing the directory. terraform init prepares the working directory for use by accounting for any changes in Terraform's backend configuration.
  2. Revewing an execution plan. ...
  3. Applying (executing) the Terraform plan.
Sep 10, 2020

How do I run a Terraform TF file? ›

If you also, need to run them more often it's better to have a terraform module. Inside the you can define which files you need to apply.
All you have to do:
  1. enter each folder.
  2. terraform init && terraform plan && terraform apply.
  3. enter 'yes' to confirm terraform apply.

Can I learn Terraform in a week? ›

Learning Terraform can be easy and could take as little as 1 week to master the basics, and as little as 3 months to really master if you are spending adequate time learning. But, of course—as always—there are some additional factors which affect how long it can take to learn Terraform.


1. Beginners Tutorial to Terraform with Azure
(Wahl Network)
2. Terraform Explained
(IBM Technology)
3. Creating a module in Terraform - Getting started with Terraform Modules (part 1)
(Cobus Bernard)
4. Terraform Modules | How to Build reusable Terraform Modules with Example | DevOps Training | Edureka
5. HashiCorp Terraform Associate Certification Course - Pass the Exam!
6. Learn how to use Terraform variables
(Cobus Bernard)


Top Articles
Latest Posts
Article information

Author: Mr. See Jast

Last Updated: 08/07/2023

Views: 6024

Rating: 4.4 / 5 (55 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Mr. See Jast

Birthday: 1999-07-30

Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

Phone: +5023589614038

Job: Chief Executive

Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.