All Products
Search
Document Center

Resource Orchestration Service:ValidateTemplate

Last Updated:Oct 14, 2025

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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

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.
The URL can be up to 1,024 bytes in length.

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.
If the template body is long, use a POST request and place the parameter in the request body. This prevents a request failure caused by an excessively long URL.
You can specify either TemplateBody or TemplateURL, but not both.




{"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:

  • None (default): No additional validation is enabled.

  • EnableTerraformValidation: For a Terraform template, the terraform validate command of the Terraform command-line interface (CLI) is used to enable additional validation.

  • EnableFastTerraformValidation: For a Terraform template, a command that is similar to the terraform validate command of the Terraform CLI is used to enable additional validation.

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:

  • Disabled: No information about the stack update is generated.

  • ConsiderCondition: The impact of conditions is considered when information about the stack update is generated. Use this option. Otherwise, the conditions are evaluated, and the parameters that are involved in the conditions are set to their default values or null.

  • EnableReplacement: The impact of a replacement update is considered when information about the stack update is generated.

Valid values:

  • ConsiderCondition :

    ConsiderCondition

  • EnableReplacement :

    EnableReplacement

  • Disabled :

    Disabled

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.
The input parameters define the parameters that you must specify when you create a stack from the template. These parameters are used to specify the details of each stack creation, such as the username, password, and the ECS instance type that is related to the environment.

[{"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
  • For ROS templates, resources whose definitions contain the Count field are not expanded.

  • For Terraform templates, resources whose definitions contain count or for_each are not expanded.

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:

  • The resource definition does not contain the Count field: If the resource name defined in the template is server, the value of this parameter is server, and the value of ResourcePath is server.

  • The resource definition contains the Count field: If the resource name defined in the template is server, the value of this parameter is server[*], and the value of ResourcePath is server.

For resources and modules in Terraform templates, the following two cases exist:

  • The definition does not contain count or for_each: If the name is server, the value of this parameter is server, and the value of ResourcePath is server.

  • The definition contains count or for_each: If the name is server, the value of this parameter is server[*], and the value of ResourcePath is server.

The following examples show the values for Terraform templates:

  • Resources in the root module:

    • server: count and for_each are not used. The value of ResourcePath is server.

    • server[*]: count or for_each is used. The value of ResourcePath is server.

  • Resources in a child module:

    • app.server: The app module does not use count or for_each, and the server resource does not use count or for_each. The value of ResourcePath is app.server.

    • app.server[*]: The app module does not use count or for_each, but the server resource uses count or for_each. The value of ResourcePath is app.server.

    • app[*].server: The app module uses count or for_each, but the server resource does not use count or for_each. The value of ResourcePath is app.server.

    • app[*].server[*]: The app module uses count or for_each, and the server resource uses count or for_each. The value of ResourcePath is app.server.

    • app.app_group[*].server: The app module does not use count or for_each, the app_group module uses count or for_each (the app_group module is a child module of the app module), and the server resource does not use count or for_each. The value of ResourcePath is app.app_group.server.

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
  • This parameter is supported for only a few resource types.

  • This parameter is applicable only to ROS stacks.

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
  • This parameter is supported for only a few resource types.

  • This parameter is applicable only to ROS stacks.

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
  • This parameter is supported for only a few resource types.

  • This parameter is applicable only to ROS stacks.

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
  • This parameter is returned only if EnableReplacement is specified for UpdateInfoOptions.

  • This parameter is applicable only to ROS stacks.

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
  • This parameter is returned only if EnableReplacement is specified for UpdateInfoOptions.

  • This parameter is applicable only to ROS stacks.

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
  • This parameter is returned only if EnableReplacement is specified for UpdateInfoOptions.

  • This parameter is applicable only to ROS stacks.

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.