All Products
Search
Document Center

Terraform:What Is Alibaba Cloud Terraform?

Last Updated:Feb 26, 2026

Alibaba Cloud recommends Terraform as your infrastructure as code (IaC) tool to manage cloud infrastructure. Before you begin, learn what Terraform is, what it does, and how it works with Alibaba Cloud.

What Is Terraform?

Terraform is an open source, declarative IaC tool developed by HashiCorp. “Declarative” means you describe the desired state of your resources in configuration files—for example, “an ECS instance with 2 vCPUs and 4 GiB of memory in the China East 1 region.” Terraform automatically handles API calls, dependencies, and execution order.

This differs fundamentally from console-based operations:

Console operations

Terraform

How you operate

Click and enter parameters step by step in the interface

Describe the desired state of resources in configuration files

Execution process

Create resources manually, one at a time, and handle dependencies manually

Automatically resolve dependencies and create resources

Environment replication

Repeat manual steps—hard to ensure consistency

Deploy multiple environments using the same configuration file

Change tracking

Rely on operation audit logs

Store configuration files in version control (such as Git). Changes are traceable and reversible.

Team collaboration

Rely on documentation and verbal agreements

Configuration files are reviewable, shareable, and reusable

Terraform shifts infrastructure management from “manual operations” to “writing and maintaining code.” It works best when you manage many resources, multiple environments, or collaborate across teams. For temporary, small-scale resource creation, console operations may be more direct.

Terraform and Alibaba Cloud

Terraform interacts with cloud platforms through provider plug-ins. Each cloud provider supplies its own provider, which translates resource definitions in configuration files into API calls for that platform.

Alibaba Cloud was the first cloud provider in China to integrate with Terraform. Its officially maintained Terraform provider (alicloud) supports most Alibaba Cloud resource types, including but not limited to:

  • Compute and containers: Elastic Compute Service (ECS), ACK, Function Compute, Auto Scaling

  • Networking: Virtual Private Cloud (VPC), Server Load Balancer (SLB), Application Load Balancer (ALB), Network Load Balancer (NLB), NAT Gateway, Cloud Enterprise Network (CEN)

  • Storage and databases: Object Storage Service (OSS), NAS, ApsaraDB RDS (RDS), PolarDB, Redis, ApsaraDB for MongoDB

  • Security and management: Resource Access Management (RAM), Key Management Service, Web Application Firewall

  • Big data and AI: MaxCompute, PAI

How Terraform Manages Resources

Terraform’s core logic compares your desired state against the actual state—and automatically calculates the actions needed.

image

The full process has three steps:

  1. Write: Describe cloud resources and their properties in configuration files—for example, ECS instance type, image, and VPC.

  2. Preview: Terraform compares your configuration files with the actual resource state. It generates a change plan listing resources to create, modify, or delete. Review this plan before any real changes occur.

  3. Execute: After confirming the plan, Terraform uses Alibaba Cloud OpenAPI to perform all operations and records the latest resource state.

Each time you update your configuration files and re-run Terraform, it only processes differences: create new resources, update changed properties, and destroy removed resources. Unchanged resources remain untouched.

Benefits of Using Terraform

  • Preview before execution: Before every run, Terraform generates a change plan listing resources to create, modify, or delete—preventing unintended changes.

  • Incremental updates: Terraform applies only the changes you make. It does not rebuild unchanged resources.

  • Unified multi-cloud management: Terraform supports providers for multiple cloud platforms. Manage Alibaba Cloud, AWS, and other resources in the same workflow.

  • Modular reuse: Package common resource combinations—such as VPC, subnets, and security groups—into modules. Reuse them across projects and environments.

  • Continuous state tracking: Terraform maintains a state file that maps each resource to its actual cloud counterpart. This ensures consistent management.

image

FAQ

Is Terraform free?

Yes. The open source version of Terraform is free. Cloud resources created with Terraform follow Alibaba Cloud’s standard billing rules—the same as resources created in the console.

Do I need programming experience to use Terraform?

No. Terraform uses HashiCorp Configuration Language (HCL), a simple, declarative configuration language. You describe resource properties—not write traditional code. If you prefer a no-code option, use Explorer to generate and run configurations through a graphical interface.

How do Terraform operations affect existing cloud resources?

Terraform manages only the resources defined in your configuration files. It does not affect existing resources that are not included. Note: Terraform’s create, modify, and delete operations act directly on live cloud resources. Always review the change plan before execution.

Can I import existing resources created in the console into Terraform?

Yes. Use the import command to bring existing resources under Terraform management. After importing, write matching configuration files to describe those resources. Then manage them uniformly with Terraform.

Can I still manage Terraform-managed resources in the console?

You can—but it is not recommended. Terraform tracks resource state in its state file. Manual changes in the console cause mismatches between the state file and actual state. On the next run, Terraform may overwrite your manual changes or cause conflicts. Manage Terraform-controlled resources exclusively through Terraform.

How does Terraform differ from ROS?

Both are declarative IaC tools. Terraform is an open source, third-party tool that supports multi-cloud management. ROS (Resource Orchestration Service) is a native Alibaba Cloud service deeply integrated with the Alibaba Cloud Management Console. Choose Terraform if you need multi-cloud support or already use Terraform elsewhere. Choose ROS if you manage mostly Alibaba Cloud resources and prefer a native tool. For more information, see What is Resource Orchestration Service?

References