System Servicesinfrastructureiaccloudprovisioningautomation

Terraform

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. It manages existing and popular service providers as well as custom in-house solutions using declarative configuration files.

Description

Terraform enables teams to safely and predictably create, change, and improve infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.

The key features include Infrastructure as Code, where infrastructure is described using a high-level configuration syntax that can be versioned and shared. Execution Plans allow generating a plan of changes before applying them, avoiding surprises. The Resource Graph builds a dependency graph for efficient parallelized creation and modification of resources.

Change Automation applies complex changesets with minimal human interaction, using execution plans and resource graphs to precisely control what changes and in what order, reducing human errors.

How It Works

Terraform uses declarative configuration files to codify infrastructure APIs. It performs a planning step to generate an execution plan showing intended changes. It builds a resource graph to parallelize non-dependent operations and applies changes in dependency order. Commands like init prepare the directory, validate checks syntax, plan shows changes, apply executes them, and destroy removes infrastructure.

Installation

bash
sudo apt install terraform

Flags

-chdir=DIRSwitch to a different working directory before executing the given subcommand.
-helpShow this help output, or the help for a specified subcommand.
-versionAn alias for the "version" subcommand.

Examples

Show usage and available commands.
terraform -h
Prepare your working directory for other commands.
terraform init
Check whether the configuration is valid.
terraform validate
Show changes required by the current configuration.
terraform plan
Create or update infrastructure.
terraform apply
Destroy previously-created infrastructure.
terraform destroy
Reformat your configuration in the standard style.
terraform fmt
Show the current version of Terraform.
terraform version
Updated 2026-04-16kali.org ↗