All Products
Search
Document Center

Resource Orchestration Service:Import an existing cloud resource to update a Terraform stack

Last Updated:Aug 19, 2024

You can import unmanaged cloud resources or cloud resources in other stacks to an existing Terraform stack for centralized management. This topic describes how to import an existing cloud resource to update a Terraform stack in the Resource Orchestration Service (ROS) console. In this example, an elastic IP Address (EIP) is imported.

Before you begin

  1. Obtain the resource identifier property of the EIP that you want to manage.

    In this example, AllocationId that specifies the ID of the EIP is obtained. For more information, see Obtain a resource identifier property for resource import.

  2. Obtain the ID of the EIP.

    Log on to the EIP console to obtain the ID of the EIP.

Procedure

  1. Log on to the ROS console.

  2. In the left-side navigation pane, click Stacks.

  3. In the top navigation bar, select the region where the desired stack resides from the region drop-down list. In this example, China (Hangzhou) is selected.

  4. On the Stacks page, find the desired stack and choose 1 > Import Resources in the Actions column.

  5. In the Select Template step, set the Template Import Method parameter to Enter Template Content.

    image

  6. In the Template Content section, add the following code. For more information, see Structure of Terraform templates.

    # Define an Alibaba Cloud EIP whose name is "example". 
    resource "alicloud_eip" "example" {
      # Specify the maximum outbound bandwidth of the EIP. Set the value to 5. Unit: Mbit/s. 
      bandwidth = 5
    }
  7. In the Configure Parameters step, configure the Stack Name and Change Set Name parameters.

  8. Configure parameters in the Configure Stack Settings section and click Next.

    In this example, the default settings of the parameters are used. For more information, see Create a stack.

  9. In the Identify Resources step, enter the resource identifier value, such as eip-bp1s1yz3aja40j377****, and click Next.

    image

  10. In the Compliance Precheck step, complete the compliance precheck and click Next.

    For more information about the compliance precheck, see Create a stack.

  11. In the Check and Confirm step, click Create Change Set.

  12. On the Change Sets tab of the stack details page, find the change set and click Execute in the Actions column to start the resource import.

  13. On the Resources tab of the stack details page, view the imported EIP.

    image

References

For more information about the ROS features and resources supported by Terraform, see ROS features and resources supported by Terraform.