You can obtain the values of parameters that are defined in a template by querying the constraints of parameters.

Background information

You can specify AssociationProperty and AssociationPropertyMetadata to filter parameters. In some scenarios, the filtered parameters may not meet your requirements.

For example, the ZoneId parameter is used by multiple Alibaba Cloud services, but the values of the ZoneId parameter vary based on different Alibaba Cloud services. In this case, you can obtain the value of the ZoneId parameter defined in a template by querying the constraint of the ZoneId parameter.

Supported parameters for query

You can call the GetTemplateParameterConstraints operation to query the values of parameters defined a template without adding parameters to the template.

Note The template whose parameters you want to query must contain the Parameters section.

The following table describes the parameters whose constraints can be queried in the template.

Resource type

Parameter

ALIYUN::CS::KubernetesCluster

Category parameter in the MasterInstanceTypes, MasterSystemDiskCategory, WorkerInstanceTypes, WorkerSystemDiskCategory, WorkerVSwitchIds, PodVswitchIds, MasterDataDisks, and WorkerDataDisks parameters

ALIYUN::CS::ManagedKubernetesCluster

Category parameter in the WorkerInstanceTypes, WorkerSystemDiskCategory, VSwitchIds, PodVswitchIds, and WorkerDataDisks parameters

ALIYUN::CS::ManagedEdgeKubernetesCluster

Category parameter in the WorkerInstanceTypes, WorkerSystemDiskCategory, WorkerDataDiskCategory, VSwitchIds, and WorkerDataDisks parameters

ALIYUN::ECS::Instance

Category parameter in the ZoneId, SystemDiskCategory, InstanceType, and DiskMappings parameters

ALIYUN::ECS::InstanceGroup

Category parameter in the ZoneId, SystemDiskCategory, InstanceType, and DiskMappings parameters

ALIYUN::ECS::VSwitch

ZoneId

ALIYUN::RDS::DBInstance

ZoneId, EngineVersion, Category, DBInstanceStorageType, and DBInstanceClass parameters

ALIYUN::RDS::PrepayDBInstance

ZoneId, EngineVersion, Category, DBInstanceStorageType, and DBInstanceClass parameters

ALIYUN::POLARDB::DBCluster

ZoneId and DBNodeClass parameters

ALIYUN::REDIS::Instance

ZoneId, EngineVersion, and InstanceClass parameters

ALIYUN::REDIS::PrepayInstance

ZoneId, EngineVersion, and InstanceClass parameters

ALIYUN::VPC::NatGateway

ZoneId

ALIYUN::ADB::DBCluster

ZoneId

ALIYUN::GPDB::DBInstance

ZoneId

ALIYUN::GPDB::ElasticDBInstance

ZoneId

ALIYUN::ALB::LoadBalancer

ZoneId parameter in the ZoneMappings parameter

ALIYUN::ElasticSearch::Instance

Spec parameter in the ZoneId. DataNode, MasterNode, and KibanaNode parameters

ALIYUN::SLB::LoadBalancer

MasterZoneId and SlaveZoneId parameters

ALIYUN::TSDB::HiTSDBInstance

InstanceClass and ZoneId parameters

Dependencies between parameters

When you use a template to create Elastic Compute Service (ECS) instances in ROS, you must specify parameters such as ZoneInfo and InstanceType.

The supported types of ECS instances vary based on different regions. Therefore, you may not set a specific value for the InstanceType parameter after you set the ZoneInfo parameter.

If you need to only set that specific value for the InstanceType parameter, you can set dependencies between parameters by configuring the Metadata section.

Note For more information about the Metadata section, see Metadata.
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters":{
    "ZoneInfo":{"Type": "String"},
    "InstanceType": {"Type": "String"}
  },
  "Resources":{
    "ECS":{
      "Type": "ALIYUN::ECS::Instance",
      "Properties":{
        "ZoneId":{"Ref": "ZoneInfo"},
        "InstanceType": {"Ref": "InstanceType"},
        "ImageId": "ubuntu"
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "InstanceType",
            "ZoneInfo"
          ]
        }
      ]
    }
  }
}