Introduction to Terraform

戚勇
2023-12-01

» What is Terraform?

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.

Terraform 是一个安全高效的创建、变更与融合基础设置的工具。Terraform
可以管理现有的解决方案、受欢迎的服务商解决方案以及内部定制的解决方案。

Configuration files describe to Terraform the components needed to run a single application or your entire datacenter. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied.

配置文件向Terraform描述运行单个应用程序或整个数据中心所需的组件。Terraform生成一个执行计划,描述如何达到所需的状态,然后执行它来构建所描述的基础架构。随着配置更改,Terraform能够确定更改的内容,并创建可应用的增量执行计划。

The infrastructure Terraform can manage includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc.

Terraform可以管理的基础架构包括计算实例,存储和网络等低级组件,以及DNS条目,SaaS功能等高级组件。

Examples work best to showcase Terraform. Please see the use cases.

The key features of Terraform are:

» Infrastructure as Code

基础设施即代码

Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your datacenter to be versioned and treated as you would any other code. Additionally, infrastructure can be shared and re-used.

基础架构使用高级配置语法进行描述。这描述了一副蓝图,可以让你的数据中心与其他代码一样被版本化和处理。另外,基础架构可以共享和重用。

» Execution Plans

执行计划

Terraform has a “planning” step where it generates an execution plan. The execution plan shows what Terraform will do when you call apply. This lets you avoid any surprises when Terraform manipulates infrastructure.

Terraform有一个“计划”步骤,它生成一个执行计划。当你调用应用程序时,执行计划显示Terraform将执行的操作。这可以避免任何因为Terraform操作基础设施产生的意外。

» Resource Graph

资源图

Terraform builds a graph of all your resources, and parallelizes the creation and modification of any non-dependent resources. Because of this, Terraform builds infrastructure as efficiently as possible, and operators get insight into dependencies in their infrastructure.

Terraform构建了所有资源的图表,并行了任何非依赖资源的创建和修改。因此,Terraform尽可能高效地构建基础架构,操作人员可以深入了解其基础架构中的依赖关系。

» Change Automation

变更自动化

Complex changesets can be applied to your infrastructure with minimal human interaction. With the previously mentioned execution plan and resource graph, you know exactly what Terraform will change and in what order, avoiding many possible human errors.

应用基础设施有复杂变更操作时,可以有最少的人为交互。通过前面提到的执行计划和资源图,您可以确切知道Terraform将会以什么顺序进行变更,从而避免很多可能的人为错误。

参考链接:
https://www.terraform.io/intro/index.html
https://github.com/hashicorp/terraform
http://www.infoq.com/cn/news/2015/05/hashimoto-modern-datacenter
(INFOQ的文章介绍的很详细)
https://github.com/alibaba/terraform-provider

核心摘要:

从企业的角度来看,一个典型的数据中心的资源使用是从单物理服务器发展而来的,经历了使用多个裸物理服务器,并最终发展成为使用多个虚拟机实例。这一进化的最新趋势是走向容器化。配置、部署和维护的复杂性一直随着这一演进而增加,人们对自动化的需求变得极为重要

 类似资料:

相关阅读

相关文章

相关问答