The ACS::Template action embeds a template into another template as a child template.
Description
The ACS::Template action embeds a template into another template as a child template. Use this action to modularize a complex template by splitting it into multiple reusable child templates. You can also define common O&M operations as child templates. CloudOps Orchestration Service (OOS) provides cloud product actions as operation templates for common cloud services that you can embed directly.
Syntax
Embed a created template by using the template name
-
General format (applicable to all templates that can be embedded)
Tasks: - Name: callChildTemplate1 Action: ACS::Template Properties: TemplateName: child_template_name # Required. The name of the child template. TemplateVersion: v2 # Optional. By default, the latest version is used. Parameters: # Optional. The parameters that are required for executing the child template. ParameterName1: value1{ "Tasks": [ { "Name": "callChildTemplate1", "Action": "ACS::Template", "Properties": { "TemplateName": "child_template_name", "TemplateVersion": "v2", "Parameters": { "ParameterName1": "value1" } } } ] } -
Simplified format (applicable only to cloud product actions)
Tasks: - Name: taskName # Required. The name of the task. Example: runMyInstances. Action: CloudProductActionName1 # Required. The name of the cloud product action. Example: ACS::ECS::RunInstances. Properties: ParameterName1: value1 # Optional. The parameter that is required for executing the cloud product action. Example: ImageId.{ "Tasks": [ { "Name": "taskName", "Action": "CloudProductActionName1", "Properties": { "ParameterName1": "parameterName1" } } ] }
Embed a new template by using the template content
Tasks:
- Name: callChildTemplate1
Action: ACS::Template
Properties:
TemplateContent:
FormatVersion: OOS-2019-06-01 # Required. The version of the template.
Parameters: # Optional. The parameters that are required for executing the child template.
Tasks: # Optional. The action that is performed by the child template.{
"Tasks": [
{
"Name": "callChildTemplate1",
"Action": "ACS::Template",
"Properties": {
"TemplateContent": {
"FormatVersion": "OOS-2019-06-01",
"Parameters": null,
"Tasks": null
}
}
}
]
}Limits
The embedding action has the following limits:
-
A template cannot embed itself.
-
Circular embedding is not allowed. For example, template A embeds B, B embeds C, and C embeds A.
-
The total number of embedding layers cannot exceed three.
-
Embedding a cloud product action counts as one layer of embedding. Loop tasks are not counted as embedding.