Review protection policies for Alibaba Cloud ROS stack updates

Define the resources and operations that need protection during stack updates.

Description

Use an Alibaba Cloud ROS stack policy to limit which resource operations are allowed during a stack update.

Potential impact

An authorized update can otherwise remove a critical resource and require recovery of data or service.

Remediation

Set the base policy in stack_policy_body or stack_policy_url. For an update that requires an exception, supply the approved temporary policy in stack_policy_during_update_body or stack_policy_during_update_url. Manage RAM permissions, stack deletion protection and backups separately.

Examples

Both templates show only the format version. Add the actual resource definitions for deployment.

Before

hcl
resource "alicloud_ros_stack" "stack" {
  stack_name    = "tf-testaccstack"
  template_body = <<EOF
{
  "ROSTemplateFormatVersion": "2015-09-01"
}
EOF
}

After

hcl
resource "alicloud_ros_stack" "stack" {
  stack_name    = "tf-testaccstack"
  template_body = <<EOF
{
  "ROSTemplateFormatVersion": "2015-09-01"
}
EOF

  stack_policy_body = <<EOF
{
  "Statement": [{
    "NotAction": "Update:Delete",
    "Resource": "*",
    "Effect": "Allow",
    "Principal": "*"
  }]
}
EOF
}

The second policy combines Allow with NotAction: Update:Delete. It permits other update operations and withholds permission to remove resources during an update.

References