Terraform is an open-source Infrastructure as Code (IaC) tool that lets you define, provision, and manage your cloud infrastructure and resources using configuration files.
What is Terraform
HashiCorp Terraform is an infrastructure automation and orchestration tool. Instead of clicking through the console, you write declarative configuration files that describe the cloud resources you need — virtual machines (VMs), storage resources, network interfaces, and more — and Terraform handles provisioning and lifecycle management.
The Terraform command-line interface (CLI) connects to Alibaba Cloud through the Alibaba Cloud provider, letting you define, preview, and deploy resources using a simple template language. With Terraform, you can create, modify, and delete resources such as Elastic Compute Service (ECS) instances, Virtual Private Cloud (VPC) networks, ApsaraDB RDS instances, and Server Load Balancer (SLB) instances.
For general Terraform documentation, see HashiCorp Terraform.
This topic describes how to use Terraform to create an ApsaraDB RDS for PostgreSQL instance.
Benefits
-
Deploy across multiple clouds
Terraform works across Alibaba Cloud, other cloud providers, and on-premises data centers. The same tools and similar configuration files manage resources on any supported platform, making multicloud and hybrid deployments consistent and repeatable.
-
Automate infrastructure management
Define your resources once in a configuration template and deploy identical environments — development, testing, and production — on demand. Terraform applies changes predictably and reduces the risk of human error during provisioning.
-
Infrastructure as Code (IaC)
Store your infrastructure definitions in configuration files. Terraform tracks resource state, so you can monitor changes to different components in your system and share configurations with your team.
-
Reduce costs
Spin up environments only when needed. Terraform also lets you preview the cost impact of configuration changes before applying them.
Use cases
For Terraform application scenarios with Alibaba Cloud, see Terraform application scenarios.