Terraform is an open source tool for automated resource orchestration. Resource Orchestration Service (ROS) allows you to manage resources by using Terraform. You can create Terraform templates and stacks to orchestrate Alibaba Cloud, Amazon Web Services (AWS), and Microsoft Azure resources. Terraform is compatible with the ROS API. You can call ROS API operations after you create a Terraform template.
Limits
Terraform supports only specific ROS features and resources. For more information, see ROS features and resources supported by Terraform.
Scenarios
Create a Terraform stack
If you want to create and manage resources across cloud platforms such as AWS and Microsoft Azure, or across on-premises platforms, you can create Terraform stacks to orchestrate and manage the resources on the platforms in a centralized manner. For more information, see Create a Terraform stack.
Create a Terraform template
If you want to create and manage resources of a third-party cloud platform such as AWS or Microsoft Azure on Alibaba Cloud, you can define the third-party resources and configure dependency relationships between the resources in a Terraform template. This way, you can conveniently manage resources across cloud platforms. For more information, see Create a Terraform template.
Template structure
Terraform is available as a managed service in ROS. You can use Terraform templates to orchestrate Alibaba Cloud, AWS, and Microsoft Azure resources. You can define resources and parameters and configure dependency relationships between resources in a Terraform template. For more information, see Structure of Terraform templates. For more information about how to define parameters in a Terraform template, see What is Terraform?
Code development
Development methods
We recommend that you use a familiar development method to write and test Terraform code. The following development methods are supported:
Use an on-premises environment.
Use the Terraform online debugging tool. This method is supported only in Alibaba Cloud.
Create a Terraform stack in the ROS console. Then, you can update the stack or continue to create the stack if the stack fails to be created based on your business requirements. For more information, see Create a Terraform stack, Continue to create a stack, and Update a stack.
Development suggestions
ROS allows you to manage resources by using Terraform. After you familiarize yourself with the related concepts of Terraform, you can follow the following suggestions to develop Terraform code and use the code in ROS. For more information, see Methods and suggestions for Terraform code development.
Refine variable definitions.
Specify the provider version.
Use pseudo parameters to obtain stack information.
Control the input mode of parameters and variables in the console.
Use Aliyun::Terraform-v1.0 or later.
Use Metadata to control the display of parameters and variables in the console.
Save on-premises code to the file whose name ends with .debug.tf.
Do not declare an Alibaba Cloud provider (alicloud) in the .tf file.
Use ROS parameters other than .tfvars files to pass variable values.
Examples of Terraform templates
For more information, see Examples of Terraform templates.