Movatterモバイル変換


[0]ホーム

URL:


HashiConf 2025Don't miss the live stream of HashiConf Day 2 happening now View live stream

Install Terraform

  • 7min
  • |
  • Terraform
  • Video

Terraform lets you safely and consistently manage your infrastructure as codeacross multiple cloud providers. To provision infrastructure with Terraform, youwill write configuration in Terraform's configuration language, configure yourcloud provider credentials, and apply your configuration with the TerraformCommand Line Interface (CLI).

To use Terraform, you first need to install it. HashiCorp distributes Terraformas a binary package. You can also install Terraform using popular packagemanagers.

Install Terraform

HashiCorp distributes Terraform as an executable CLI that you can install onsupported operating systems, including Microsoft Windows, macOS, and severalLinux distributions. You can also compile the Terraform CLI from source if apre-compiled binary is not available for your system.

If you use a package manager to install software on your macOS, Windows, orLinux system, you can use it to install Terraform.

Homebrew is a free and open-source package management systemfor macOS. If you have Homebrew installed, use it to install Terraform from yourcommand line.

First, install the HashiCorp tap, which is Hashicorp's official repository ofall our Homebrew packages.

$ brew tap hashicorp/tap

Now, install Terraform fromhashicorp/tap/terraform.

$ brew install hashicorp/tap/terraform

Terraform versions and compatibility

HashiCorp regularly releases new versions of Terraform with new features and bugfixes. HashiCorp maintains compatibility between Terraform versions, so aTerraform configuration written for one version of Terraform should continue towork with any later minor version update. Refer to theTerraform compatibilitypromise for more details.

Verify the Installation

Verify that the installation worked by opening a new terminal session andlisting Terraform's available subcommands.

$ terraform -helpUsage: terraform [global options] <subcommand> [args]The available commands for execution are listed below.The primary workflow commands are given first, followed byless common or more advanced commands.Main commands:##...

Add-help to any Terraform command to learn more about what it does andavailable options.

$ terraform plan -help

Enable tab completion

If you use either Bash or Zsh as your command line shell, you can enable tabcompletion for Terraform commands. To enable autocomplete, first ensure that aconfiguration file exists for your chosen shell.

$ touch~/.bashrc

Then install the autocomplete package.

$ terraform -install-autocomplete

After installing autocomplete support, you will need to restart your shell toenable it.

Next steps

Now that you have installed Terraform, you can use it to create and manageinfrastructure with the cloud provider of your choice. Get started with one ofthe following providers:

This tutorial also appears in:

  • 7 tutorials
    Get Started - OCI
    Build, change, and destroy a virtual cloud network and subnet on Oracle Cloud Infrastructure (OCI) using Terraform. Step-by-step, command-line tutorials will walk you through the Terraform basics for the first time.
    • Terraform
  • 7 tutorials
    Get Started - Google Cloud
    Build, change, and destroy Google Cloud Platform (GCP) infrastructure using Terraform. Step-by-step, command-line tutorials will walk you through the Terraform basics for the first time.
    • Terraform
  • 7 tutorials
    Get Started - Docker
    Build, change, and destroy Docker infrastructure using Terraform. Step-by-step, command-line tutorials will walk you through the Terraform basics for the first time.
    • Terraform
  • 8 tutorials
    Get Started - Azure
    Build, change, and destroy Azure infrastructure using Terraform. Step-by-step, command-line tutorials will walk you through the Terraform basics for the first time.
    • Terraform

[8]ページ先頭

©2009-2025 Movatter.jp