If a resource has properties that cannot be directly modified, you can update the resource by replacing it.
Background information
To modify only the properties of a resource without changing its physical ID, you can modify the parameters in the stack template.
If a resource has properties that cannot be directly modified, you can use the replace update feature. This feature deletes the resource and then recreates it. This process changes the physical resource ID. This topic describes how to replace and update a resource, using the CidrBlock property of an ALIYUN::ECS::VSwitch resource as an example.
Procedure
-
Log on to the Resource Orchestration Service console.
-
Create a stack.
Use the following template to create a stack that contains an
ALIYUN::ECS::VSwitchresource. Set the CidrBlock property to 172.16.100.0/24.For more information, see Create a stack.
ROSTemplateFormatVersion: '2015-09-01' Parameters: ZoneId: Type: String Default: cn-hangzhou-i VSwitchCidrBlock: Type: String Default: 172.16.100.0/24 Resources: EcsVpc: Type: ALIYUN::ECS::VPC Properties: CidrBlock: 172.16.0.0/12 VpcName: MyTestVpc VSwitch: Type: ALIYUN::ECS::VSwitch Properties: ZoneId: Ref: ZoneId CidrBlock: Ref: VSwitchCidrBlock VpcId: Fn::GetAtt: - EcsVpc - VpcId VSwitchName: VSwitch Outputs: {} -
Replace and update the stack.
-
In the left navigation pane, click Stacks.
-
In the top menu bar, select a region for the stack from the region drop-down list. For example, select China (Hangzhou).
-
On the Stacks page, find the stack that you want to update and click Update in the Actions column.
-
On the Configure Parameters page, under Configure Template Parameters, change
VSwitchCidrBlockfrom 172.16.100.0/24 to 172.16.200.0/24. -
In the Configure Stack Settings section, click Enable to enable the replace update feature.
-
Click the Modify button.
After a successful replacement update, the physical ID of the vSwitch resource changes, and the value of the CidrBlock parameter changes from 172.16.100.0/24 to 172.16.200.0/24. You can view the resource information on the vSwitch details page. To access the page, click the Resources tab on the stack details page, and then click the new vSwitch resource ID.
-