Terraform 是一个开源基础设施,作为一种代码软件工具,它提供一致的 CLI 工作流程来管理数百个云服务. Terraform 将云 API 编码为声明性配置文件。Terraform 由 Hashicorp 构建并在 Mozilla Public License 下发布。它支持公共云、私有云和混合云,截至目前,Terraform 支持 145 个提供商,其中包括 AWS、Azure 云、GCP、Oracle 云等流行的提供商。terraform-logoterraform-logo

在 Fedora 35 上安装 Terraform

第 1 步:在继续之前,更新您的 Fedora 操作系统以确保所有现有的软件包都是最新的。使用此命令更新服务器包:

sudo dnf upgrade
sudo dnf update
sudo dnf install dnf-plugins-core

步骤 2. 在 Fedora 35 上安装 Terraform。

默认情况下,Terraform 在 Fedora 35 基础存储库中可用。现在我们使用以下命令将 Terraform HashiCorp 存储库添加到您的系统:

sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo

接下来,再次更新系统存储库并使用以下命令安装 Terraform 包:

sudo dnf update
sudo dnf install terraform

通过打开一个新的终端会话并列出 Terraform 的可用子命令来验证安装是否有效:

$ terraform -help
Usage: terraform [global options]  [args]

The available commands for execution are listed below.
The primary workflow commands are given first, followed by
less common or more advanced 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 an interactive command prompt
  fmt           Reformat your configuration in the standard style
  force-unlock  Release a stuck lock on the current workspace
  get           Install or upgrade remote Terraform modules
  graph         Generate a Graphviz graph of the steps in an operation
  import        Associate existing infrastructure with a Terraform resource
  login         Obtain and save credentials for a remote host
  logout        Remove locally-stored credentials for a remote host
  output        Show output values from your root module
  providers     Show the providers required for this configuration
  refresh       Update the state to match remote systems
  show          Show the current state or a saved plan
  state         Advanced state management
  taint         Mark a resource instance as not fully functional
  test          Experimental support for module integration testing
  untaint       Remove the \'tainted\' state from a resource instance
  version       Show the current Terraform version
  workspace     Workspace management

感谢您使用本教程在 Fedora 35 系统上安装 Terraform。如需其他帮助或有用信息,我们建议您查看Terraform 官方网站。