Terraform入门 - 1. 安装Terraform

[TOC]

原文地址:https://www.terraform.io/intro/getting-started/install.html

你机器上必须要先安装Terraform。Terraform为所有平台和架构发布的版本为二进制包。本页面不包含如何从源代码编译Terraform,对于确定希望从源代码编译出自己相信的最终二进制文件的用户可以参考文档

安装Terraform

安装Terraform,找到与你系统匹配的软件包然后下载。Terraform被打包为一个zip归档文件。

下载完zip文件以后,解压这个包。Terraform是一个名为terraform的独立文件。包里其他所有的文件都可以安全删掉,Terraform依然可以正常工作。

最后一步确保terraform二进制文件在PATH上可用。在Linux和Mac上设置PATH请查看此页面。Windows设置PATH的命令在此页面

校验安装

Terraform安装完以后,确认该安装在新开的终端中可运行,并检验terraform可用。通过执行terraform你将看到类似如下的输出的帮助信息:

$ terraform
Usage: terraform [--version] [--help] <command> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.

Common commands:
    apply              Builds or changes infrastructure
    console            Interactive console for Terraform interpolations
# ...

如果你遇到一个terraform 未找到的错误,(因为)你的PATH环境变量没有设置正确。请回去检查确保你的PATH环境变量包含你terraform的安装目录。

下一步

到了使用最小化Terraform配置文件构建基础设施的时间了。在你部署它到AWS之前可以检查执行计划。

猜你喜欢

转载自blog.csdn.net/weixin_33795833/article/details/87069855