Review stack retention when removing an Alibaba Cloud ROS stack instance

Decide whether the underlying stack must survive removal of its stack instance.

Description

When a ROS stack instance is removed from a stack group, retain_stacks controls whether its underlying stack survives. The default, false, deletes the associated stack.

Potential impact

Removing a stack that still serves a workload can interrupt service and require redeployment or data restoration.

Remediation

To keep the stack, apply retain_stacks = true in a separate Terraform run. Confirm that Terraform state shows true, then remove the instance. Assign an owner for the retained stack and its costs, and back up data you may need to restore.

Examples

Use the target account ID, Region and stack group for your environment.

Before

hcl
resource "alicloud_ros_stack_instance" "example" {
  stack_group_name          = alicloud_ros_stack_group.example.stack_group_name
  stack_instance_account_id = var.account_id
  stack_instance_region_id  = data.alicloud_ros_regions.example.regions.0.region_id
  retain_stacks             = false
}

After

hcl
resource "alicloud_ros_stack_instance" "example" {
  stack_group_name          = alicloud_ros_stack_group.example.stack_group_name
  stack_instance_account_id = var.account_id
  stack_instance_region_id  = data.alicloud_ros_regions.example.regions.0.region_id
  retain_stacks             = true
}

With true, removal detaches the stack from its group. The stack can still be deleted separately.

References