In a Resource Orchestration Service (ROS) template, `AssociationProperty` retrieves available resources in the selected region, and `AssociationPropertyMetadata` adds filter conditions for parameters. Together, they let you dynamically select parameter values in the console without switching between multiple consoles.
Parameter description
The `AssociationPropertyMetadata` parameter accepts the following values:
-
You can specify a specific value for the parameter. For example, if you specify
"RegionId": "cn-hangzhou", ROS uses the `cn-hangzhou` region. -
You can specify a variable for the parameter in the format
${ParameterKey}. For example, if you specify"VpcId": "${VpcId}", ROS dynamically retrieves the value of the `VpcId` parameter from the current template.Note-
To specify
${ParameterKey}as a static field, add an exclamation mark (!). For example,${!Literal}evaluates to the literal string${Literal}. -
To use a parameter variable in a Terraform template, add a
$before the$. For example, if you specify"VpcId": "$${VpcId}", ROS dynamically retrieves the value of `VpcId` from the Terraform template.
-
The required `AssociationPropertyMetadata` varies based on the resource type specified in `AssociationProperty`.
-
Custom resources: Configures custom resources, such as data queries that are based on parameters for Alibaba Cloud product OpenAPI.
-
Basic resources: Configures common basic parameter types.
-
ACR resources: Container Registry Personal Edition resources.
-
APIG resources: API Gateway resources.
-
ALB resources: Application Load Balancer resources.
-
Bailian resources: Model Studio resources.
-
BSS resources: User Center resources.
-
CAS resources: SSL Certificate resources.
-
CEN resources: Cloud Enterprise Network resources.
-
CMS resources: Cloud Monitor resources.
-
CR resources: Container Registry Enterprise Edition resources.
-
CS resources: Container Service for Kubernetes resources.
-
ComputeNest resources: Compute Nest resources.
-
ComputeNestSupplier resources: Compute Nest supplier resources.
-
DNS resources: Alibaba Cloud DNS resources.
-
DashVector resources: DashVector Vector Retrieval Service resources.
-
Domain resources: Domain Names resources.
-
EAS resources: Machine Learning PAI-EAS resources.
-
ECD resources: Cloud Desktop resources.
-
ECI resources: Elastic Container Instance resources.
-
ECS resources: Elastic Computing Service (ECS) resources.
-
EHPC resources: Elastic High Performance Computing resources.
-
ESS resources: Auto Scaling resources.
-
Elasticsearch resources: Elasticsearch resources.
-
Emr resources: E-MapReduce resources.
-
FC3 resources: Function Compute (FC3) resources.
-
FC resources: Function Compute resources.
-
Flow resources: Logic Composer resources.
-
Hologres resources: Hologres resources.
-
InfluxDB resources: Time Series Database InfluxDB resources.
-
Kafka resources: Message Queue for Kafka resources.
-
Lindorm resource: A resource within the Lindorm service.
-
MongoDB resources: ApsaraDB for MongoDB resources.
-
NAS resources: File Storage NAS resources.
-
NLB resources: Network Load Balancer (NLB) resources.
-
OOS resources: Operation Orchestration Service (OOS) resources.
-
OSS resources: Object Storage Service (OSS) resources.
-
PolarDB resources: PolarDB resources.
-
RAM resources: Resource Access Management (RAM) resources.
-
RDS resources: ApsaraDB RDS resources.
-
Redis resources: Redis resources.
-
ResourceManager resources: Resource Management resources.
-
SAE resources: Serverless App Engine (SAE) resources.
-
SLB resources: Server Load Balancer (SLB) resources.
-
ServiceCatalog resources: Service Catalog resources.
-
Tag resources: Tag resources.
-
User resources: User resources.
-
VPC resources: Virtual Private Cloud (VPC) resources.
Examples
Example 1: AssociationProperty example
Set `AssociationProperty` to `ALIYUN::ECS::Image::ImageId` to retrieve all image IDs in the selected region.
JSON example:
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"UserName": {
"Label": "Username",
"Description": "Enter a username",
"Default": "anonymous",
"Type": "String",
"MinLength": "6",
"MaxLength": "12",
"AllowedValues": [
"anonymous",
"user-one",
"user-two"
]
},
"PassWord": {
"Label": "Password",
"NoEcho": "True",
"Description": "Enter a user password",
"Type": "String",
"MinLength": "1",
"MaxLength": "41",
"AllowedPattern": "[a-zA-Z0-9]*"
},
"ImageId": {
"Label": "Image",
"Type": "String",
"Description": "Select an image",
"AssociationProperty": "ALIYUN::ECS::Image::ImageId",
"Default": "centos_7_7_x64_20G_alibase_2020****.vhd"
}
}
}
YAML example:
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
UserName:
Label: Username
Description: Enter a username
Default: anonymous
Type: String
MinLength: '6'
MaxLength: '12'
AllowedValues:
- anonymous
- user-one
- user-two
PassWord:
Label: Password
NoEcho: 'True'
Description: Enter a user password
Type: String
MinLength: '1'
MaxLength: '41'
AllowedPattern: '[a-zA-Z0-9]*'
ImageId:
Label: Image
Type: String
Description: Select an image
AssociationProperty: ALIYUN::ECS::Image::ImageId
Default: centos_7_7_x64_20G_alibase_2020****.vhd
Parameter description:
-
UserName: The username. This parameter is a string that must be 6 to 12 characters in length. Valid values:
-
anonymous (default)
-
user-one
-
user-two
-
-
PassWord: The password. This parameter is a string that must be 1 to 41 characters in length and can contain uppercase letters, lowercase letters, and digits. No default value.
If `NoEcho` is set to `true`, the parameter value is not returned when you query the stack.
-
ImageId: The image ID. String type.
When `AssociationProperty` is set to `ALIYUN::ECS::Image::ImageId`, the ROS console validates the specified image ID during stack creation and lists other available image IDs in the selected region in a drop-down list.
Example 2: AssociationPropertyMetadata example
Specify `AssociationProperty` with the corresponding `AssociationPropertyMetadata` (`RegionId`, `VpcId`, and `ZoneId`) to retrieve the vSwitch for a specific virtual private cloud (VPC) and zone. In this example, `RegionId` is set to the static field `cn-hangzhou`, while `VpcId` and `ZoneId` use the variables `${VpcId}` and `${EcsZone}`. These variables refresh dynamically based on the selected values for `ALIYUN::ECS::VPC::VPCId` and `ZoneId`, associating the vSwitch with the VPC and zone.
For parameters such as `EcsZone` that have `AllowedValues` configured, add `AutoChangeType` to `AssociationPropertyMetadata` and set it to `false`. This displays the `AllowedValues` as a drop-down list in the ROS console.
JSON example:
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"VpcId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
},
"EcsZone": {
"Type": "String",
"AllowedValues": [
"cn-hangzhou-i",
"cn-hangzhou-j",
"cn-hangzhou-k",
"cn-hangzhou-h"
],
"AssociationPropertyMetadata": {
"AutoChangeType": false
}
},
"VSwitchId": {
"Type": "String",
"AssociationProperty": "ALIYUN::VPC::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"RegionId": "cn-hangzhou",
"VpcId": "${VpcId}",
"ZoneId": "${EcsZone}"
}
}
}
}
YAML example:
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
VpcId:
Type: String
AssociationProperty: ALIYUN::ECS::VPC::VPCId
EcsZone:
Type: String
AllowedValues:
- cn-hangzhou-i
- cn-hangzhou-j
- cn-hangzhou-k
- cn-hangzhou-h
AssociationPropertyMetadata:
AutoChangeType: false
VSwitchId:
Type: String
AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
AssociationPropertyMetadata:
RegionId: cn-hangzhou
VpcId: ${VpcId}
ZoneId: ${EcsZone}
Example 3: Terraform automatic transformation example
When `AssociationProperty` is set to `Auto`, ROS automatically generates `AssociationProperty` and `AssociationPropertyMetadata` fields based on the original Terraform data structure.
More examples
You can also use `AssociationProperty` and `AssociationPropertyMetadata` to: