BlogWissenwertesTerraform: Classification and operating principle

Terraform: Classification and operating principle

Ein Beitrag von Thomas Mohrbacher

Why Terraform? – Part II

In our first blog post, we gave you a brief introduction and overview of Terraform.
In this article, we will now delve deeper into the topic of Terraform.

IaC and Terraform

As explained by HashiCorp, the official developer of Terraform, Terraform is an „open-source infrastructure as code tool.“ HashiCorp’s primary goal is to support multiple providers, abstract the API communication with them, and provide resource templates in its own language called HCL (HashiCorp Configuration Language). This setup, especially the use of a single declarative language like HCL, is designed to help users manage resources across multiple providers without requiring in-depth knowledge of APIs or programming experience.

Abb. 1

Example: Azure MSSQL database template

In HCL, the desired final state is described, and changes are deployed through a series of steps named „init,“ „plan,“ and „apply.“ The „init“ step verifies and establishes a connection to the provider, updating the project’s resource and module index. The „plan“ step provides an overview of the planned changes (create, update, delete), which are subsequently realized in the „apply“ step.

Abb. 2

Basic Terraform pipeline

To keep track of these differences, Terraform utilizes a „state“ file (representing the status of the last apply) and compares it with the current code definition and the resource status of the provider.

Abb. 3

Example: Updating a threshold value for an alert resource

A common setup typically includes a combination of infrastructure configuration files (.tf), a repository containing these files, the Terraform core with its fundamental framework implementation, and a state file stored in a file storage system

Deployments can be executed either manually from a local workspace or triggered automatically through a pipeline. Terraform then interacts with the provider APIs and verifies the success or failure of the operation

Abb. 4

Overview how Terraform works

Schreiben Sie einen Kommentar

Ihre E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert