All Products
Search
Document Center

Resource Orchestration Service:ValidateTemplate

Last Updated:Jun 10, 2026

Memvalidasi template yang digunakan untuk membuat stack dengan menentukan URL atau badan template.

Deskripsi operasi

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.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tidak ada otorisasi untuk operasi ini. Jika Anda mengalami masalah saat menjalankan operasi ini, hubungi dukungan teknis.

Parameter permintaan

Parameter

Type

Required

Description

Example

TemplateURL

string

No

Lokasi file yang berisi badan template. URL harus mengarah ke template yang berada di server web HTTP atau di bucket OSS Alibaba Cloud, seperti oss://ros/template/demo atau oss://ros/template/demo?RegionId=ap-southeast-1. Template dapat berukuran hingga 524.288 byte.

Catatan

Jika Anda tidak menentukan wilayah bucket OSS, nilai parameter RegionId akan digunakan.

Anda dapat menentukan TemplateBody atau TemplateURL, tetapi tidak keduanya.
URL dapat memiliki panjang hingga 1.024 byte.
.

oss://ros/template/demo

RegionId

string

No

ID wilayah template stack. Anda dapat memanggil operasi DescribeRegions untuk mengkueri daftar wilayah Alibaba Cloud terbaru.

cn-hangzhou

TemplateBody

string

No

Struktur badan template. Badan template dapat memiliki panjang 1 hingga 524.288 byte.
Jika badan template panjang, gunakan permintaan POST dan tempatkan parameter di badan permintaan. Hal ini mencegah kegagalan permintaan yang disebabkan oleh URL yang terlalu panjang.
Anda dapat menentukan TemplateBody atau TemplateURL, tetapi tidak keduanya.

.

{"ROSTemplateFormatVersion":"2015-09-01"}

ClientToken

string

No

Token klien yang digunakan untuk memastikan idempotensi permintaan. Klien menghasilkan nilai, yang harus unik.

Token dapat memiliki panjang hingga 64 karakter dan dapat berisi huruf, digit, tanda hubung (-), dan garis bawah (_).

Untuk informasi lebih lanjut, lihat Cara memastikan idempotensi.

123e4567-e89b-12d3-a456-42665544****

ValidationOption

string

No

Apakah akan mengaktifkan validasi tambahan untuk template. Nilai valid:

  • None (default): Tidak ada validasi tambahan yang diaktifkan.

  • EnableTerraformValidation: Untuk Template Terraform, perintah terraform validate dari Antarmuka baris perintah (CLI) Terraform digunakan untuk mengaktifkan validasi tambahan.

  • EnableFastTerraformValidation: Untuk Template Terraform, perintah yang mirip dengan perintah terraform validate dari CLI Terraform digunakan untuk mengaktifkan validasi tambahan.

Catatan

Dibandingkan dengan EnableTerraformValidation, EnableFastTerraformValidation lebih cepat tetapi kurang komprehensif.

None

UpdateInfoOptions

array

No

Daftar opsi untuk informasi pembaruan. Daftar dapat berisi hingga dua opsi.

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

Untuk informasi lebih lanjut tentang parameter permintaan umum, lihat Parameter umum.

Elemen respons

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.

Catatan
  • 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.

Catatan
  • 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.

Catatan
  • 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.

Catatan
  • 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.

Catatan
  • 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.

Catatan
  • 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.

Catatan
  • 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

Contoh

Respons sukses

JSONformat

{
  "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"
    ]
  }
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.