ALIYUN::ROS::CustomResource creates a custom resource that runs your own configuration logic during stack operations.
In ROS templates, use ALIYUN::ROS::CustomResource or Custom::String to define a custom resource.
Custom resources let you embed configuration logic in templates that ROS runs during stack create, update, or delete operations. Overview of custom resources.
A custom resource must send a response to a presigned URL, or the stack operation fails. ResponseURL supports the public network; InnerResponseURL supports the Alibaba Cloud private network.
Syntax
{
"Type": "ALIYUN::ROS::CustomResource",
"Properties": {
"ServiceToken": String,
"Timeout": Number,
"Parameters": Map
}
}
Properties
|
Property |
Type |
Required |
Enable updates |
Description |
Constraints |
|
ServiceToken |
String |
Yes |
No |
The service token provided by the service provider for accessing the service. Currently, support is provided for Function Compute function, SMQ ( Simple Message Queue (formerly MNS) ) Topic, SMQ Queue, HTTP&HTTPS. Maximum length: 512 characters. |
Valid values:
Examples:
|
|
Timeout |
Number |
Yes |
Yes |
Timeout for the custom service provider to respond, in seconds. |
|
|
Parameters |
Map |
No |
Yes |
Parameters to pass to the custom service provider. Define according to the provider's specifications. |
None. |
Return values
Fn::GetAtt
-
Outputs: The data returned by the custom service provider, which is a map object.
-
*: A key in the Outputs map.
Examples
ROSTemplateFormatVersion: '2015-09-01'
Resources:
CustomResource:
Type: ALIYUN::ROS::CustomResource
Properties:
ServiceToken: acs:fc:cn-hangzhou:123456789:services/test-service/functions/test-function
Parameters:
Key1: Value1
Key2: Value2
Timeout: 60
Parameters:
Parameters:
Type: Json
Description: Parameters to be passed to service provider.
Outputs:
Outputs:
Description: Output data received from service provider.
Value:
Fn::GetAtt:
- CustomResource
- Outputs{
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"CustomResource": {
"Type": "ALIYUN::ROS::CustomResource",
"Properties": {
"ServiceToken": "acs:fc:cn-hangzhou:123456789:services/test-service/functions/test-function",
"Parameters": {
"Key1": "Value1",
"Key2": "Value2"
},
"Timeout": 60
}
}
},
"Parameters": {
"Parameters": {
"Type": "Json",
"Description": "Parameters to be passed to service provider."
}
},
"Outputs": {
"Outputs": {
"Description": "Output data received from service provider.",
"Value": {
"Fn::GetAtt": [
"CustomResource",
"Outputs"
]
}
}
}
}Remarks
-
Specify a name for a custom resource type
You can use ALIYUN::ROS::CustomResource as the resource type or define your own name. For example, use Custom::MyCustomResourceTypeName instead of ALIYUN::ROS::CustomResource.
The name of a custom resource type can contain letters, numbers, and the following special characters:
_@-. The name can be up to 68 characters in length. You cannot change the type during an update.Custom type names help distinguish resources in your stack. For example, name two ping-testing resources Custom::PingTester to identify them at a glance.
-
Replacing custom resources during updates
The PhysicalResourceId of a resource cannot be replaced during an update in ROS.
-
Retrieve return values
Return values are defined by the custom service provider. Retrieve them from the provider-defined properties by calling Fn::GetAtt.