Validates a template that is used to create a stack by specifying template URL or body.
Operation description
This API operation validates only templates and does not involve user data. RAM authentication is not required.
This topic provides an example of how to validate a stack template. In this example, the TemplateURL of the template file is oss://ros/template/demo.
Try it now
Test
RAM authorization
Request parameters
Parameter | Type | Required | Description | Example |
TemplateURL | string | No | The location of the file that contains the template body. The URL must point to a template that is located on an HTTP web server or in an Alibaba Cloud OSS bucket, such as oss://ros/template/demo or oss://ros/template/demo?RegionId=cn-hangzhou. The template can be up to 524,288 bytes in size. Note If you do not specify the region of the OSS bucket, the value of the RegionId parameter is used. You can specify either TemplateBody or TemplateURL, but not both. | oss://ros/template/demo |
RegionId | string | No | The region ID of the stack template. You can call the DescribeRegions operation to query the most recent list of Alibaba Cloud regions. | cn-hangzhou |
TemplateBody | string | No | The structure of the template body. The template body can be 1 to 524,288 bytes in length. | {"ROSTemplateFormatVersion":"2015-09-01"} |
ClientToken | string | No | A client token that is used to ensure the idempotence of the request. The client generates the value, which must be unique. The token can be up to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_). For more information, see How to ensure idempotence. | 123e4567-e89b-12d3-a456-42665544**** |
ValidationOption | string | No | Specifies whether to enable additional validation for the template. Valid values:
Note Compared with EnableTerraformValidation, EnableFastTerraformValidation is faster but less comprehensive. | None |
| UpdateInfoOptions | array | No | The list of options for the update information. The list can contain up to two options. | |
string | No | The option for the update information. This option is used to control the generation of information about the stack update. Valid values:
Valid values:
| ConsiderCondition |
For more information about common request parameters, see Common parameters.
Response elements
Element | Type | Description | Example |
object | |||
Description | string | The description of the stack template. | No description |
| Parameters | array<object> | The list of input parameters. | |
object | The input parameter. | [{"Description": "", "Label": "param_integer", "NoEcho": "false", "ParameterKey": "param_integer", "Type": "Number"},{ "Description": "", "Label": "param_float", "NoEcho": "false", "ParameterKey": "param_float", "Type": "Number"}] | |
RequestId | string | The request ID. | B288A0BE-D927-4888-B0F7-B35EF84B6E6F |
| Outputs | array<object> | The list of template outputs. | |
object | |||
OutputKey | string | The name of the template output. | instance_id |
Description | string | The description of the template output. | The instance ID of my ECS. |
Label | string | The alias of the template output. | Instance ID |
| ResourceTypes | object | The information about the resource types that are used in the template. | |
| Resources | array | The list of regular resource types. Duplicates are removed. | |
string | The regular resource type. | ALIYUN::ECS::InstanceGroup | |
| DataSources | array | The list of data source resource types. Duplicates are removed. | |
string | The data source resource type. | DATASOURCE::VPC::Vpcs | |
| Resources | array<object> | The list of regular resources that are defined in the template. Note
| |
object | |||
ResourceType | string | The regular resource type. | ALIYUN::ECS::InstanceGroup |
ResourcePath | string | The path of the regular resource. The path is usually the same as the resource name. | server |
LogicalResourceIdPattern | string | The string pattern for the logical ID of the regular resource. For ROS templates, the following two cases exist:
For resources and modules in Terraform templates, the following two cases exist:
The following examples show the values for Terraform templates:
| server |
| UpdateInfo | object | The information about the stack update. This parameter is not returned if Disabled is specified for UpdateInfoOptions. | |
| ParametersAllowedToBeModified | array | The list of parameters that can be modified. | |
string | A parameter that can be modified. When you update a stack, if the template remains unchanged, you can change the value of this parameter without causing a validation error. | param1 | |
| ParametersCauseInterruptionIfModified | array | The list of parameters that cause resource interruptions if they are modified. Note
| |
string | A parameter that causes a resource interruption if it is modified. When you update a stack, if the template remains unchanged, changing the value of this parameter will cause a resource interruption. | param1 | |
| ParametersConditionallyAllowedToBeModified | array | The list of parameters that may be allowed to be modified. | |
string | A parameter that may be allowed to be modified. When you update a stack, if the template remains unchanged, whether a validation error is caused by a change to the value of this parameter depends on the new value. | param2 | |
| ParametersConditionallyCauseInterruptionIfModified | array | The list of parameters that may cause resource interruptions if they are modified. Note
| |
string | A parameter that may cause a resource interruption if it is modified. When you update a stack, if the template remains unchanged, changing the value of this parameter may cause a resource interruption. This depends on the new value and the update behavior of the resource. | param2 | |
| ParametersNotAllowedToBeModified | array | The list of parameters that cannot be modified. | |
string | A parameter that cannot be modified. When you update a stack, if the template remains unchanged, changing the value of this parameter will cause a validation error. | param3 | |
| ParametersUncertainlyAllowedToBeModified | array | The list of parameters whose modification permissions are uncertain. | |
string | A parameter whose modification permission is uncertain. When you update a stack, if the template remains unchanged, whether a validation error is caused by a change to the value of this parameter can be determined only at runtime. | param4 | |
| ParametersUncertainlyCauseInterruptionIfModified | array | The list of parameters that cause resource interruptions under uncertain conditions if they are modified. Note
| |
string | A parameter that causes a resource interruption under uncertain conditions if it is modified. When you update a stack, if the template remains unchanged, whether a resource interruption is caused by a change to the value of this parameter can be determined only at runtime. | param4 | |
| ParametersCauseReplacementIfModified | array | The list of parameters that cause replacement updates if they are modified. Note
| |
string | A parameter that causes a replacement update if it is modified. When you update a stack, if the template remains unchanged, changing the value of this parameter will cause a replacement update. | param5 | |
| ParametersConditionallyCauseReplacementIfModified | array | The list of parameters that may cause replacement updates if they are modified. Note
| |
string | A parameter that may cause a replacement update if it is modified. When you update a stack, if the template remains unchanged, changing the value of this parameter may cause a replacement update. This depends on the new value. | param6 | |
| ParametersUncertainlyCauseReplacementIfModified | array | The list of parameters that cause replacement updates under uncertain conditions if they are modified. Note
| |
string | A parameter that causes a replacement update under uncertain conditions if it is modified. When you update a stack, if the template remains unchanged, whether a replacement update is caused by a change to the value of this parameter can be determined only at runtime. | param7 |
Examples
Success response
JSON format
{
"Description": "No description",
"Parameters": [
[
{
"Description": "",
"Label": "param_integer",
"NoEcho": "false",
"ParameterKey": "param_integer",
"Type": "Number"
},
{
"Description": "",
"Label": "param_float",
"NoEcho": "false",
"ParameterKey": "param_float",
"Type": "Number"
}
]
],
"RequestId": "B288A0BE-D927-4888-B0F7-B35EF84B6E6F",
"Outputs": [
{
"OutputKey": "instance_id",
"Description": "The instance ID of my ECS.",
"Label": "Instance ID"
}
],
"ResourceTypes": {
"Resources": [
"ALIYUN::ECS::InstanceGroup"
],
"DataSources": [
"DATASOURCE::VPC::Vpcs"
]
},
"Resources": [
{
"ResourceType": "ALIYUN::ECS::InstanceGroup",
"ResourcePath": "server",
"LogicalResourceIdPattern": "server"
}
],
"UpdateInfo": {
"ParametersAllowedToBeModified": [
"param1"
],
"ParametersCauseInterruptionIfModified": [
"param1"
],
"ParametersConditionallyAllowedToBeModified": [
"param2"
],
"ParametersConditionallyCauseInterruptionIfModified": [
"param2"
],
"ParametersNotAllowedToBeModified": [
"param3"
],
"ParametersUncertainlyAllowedToBeModified": [
"param4"
],
"ParametersUncertainlyCauseInterruptionIfModified": [
"param4"
],
"ParametersCauseReplacementIfModified": [
"param5"
],
"ParametersConditionallyCauseReplacementIfModified": [
"param6"
],
"ParametersUncertainlyCauseReplacementIfModified": [
"param7"
]
}
}Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.