Getting Started

In order to start a new Terraform project, there are two things you need to do in order.


Create a versions.tf

This is where you state which provider the terraform files need, and which version.

terraform {
  required_providers {
    some_provider = {
      source = "hashicorp/the_provider"
      version = "~> 5.52.0"
    }
  }
  required_version = "~> 1.1.9"
}

You can find the provider you need at the official terraform provider registry.


Run terraform init

You then run terraform init in the directory in which you want to start the project. It is the first command you should run after writing a Terraform configuration.

The command ensures that the project is correctly configured, downloads the provider plugins and is ready for the subsequent Terraform commands.


Providers

The Terraform Providers are plugins that enable interaction with external APIs, such as Azure, AWS, Hetzner, even Minecraft.

Each provider usually requires configuration, typically including the authentication details and endpoint URLS. There can be multiple providers per Terraform project, in order to manage resources across different platforms.