inputs
To enable a template to be more commonly used, do not set all parameter values of the elements to fixed values. For example, it is recommended that the image ID of a VM be used as an input of a template. In this case, users can set the value of this parameter freely. The image ID is set only when the template is used, that is, during stack deployment.
The inputs section is optional and defines the inputs of a stack created based on a template. A maximum of 60 input parameters can be defined in a template. Each input parameter must have a unique name so that the value can be obtained by using the get_input built-in function. If an input parameter is defined repeatedly, the latest definition will overwrite the previous one.
Function scope: node_templates and outputs sections. That is, input parameters can be transferred in the properties of node_templates and values of outputs.
Format of the inputs section:
<Input parameter name>: type: <Type> default: <Default value> constraints: <Constraints> description: <Description> label: <Label> invisible: <Whether command outputs are visible>
In addition to the reusability of a template, methods of restricting and verifying user inputs also need to be considered during template input design. Designers must understand parameter statements.
Property |
Mandatory |
Type |
Value Constraint |
Description |
---|---|---|---|---|
Input parameter name |
Yes |
String |
The value must be 1 to 20 characters long. Only lowercase letters, digits, and hyphens (-) are allowed. |
A maximum of 60 input parameter names can be defined and each name must be unique. |
type |
Yes |
|
When the type is set to password, no output is visible. Currently, only the passwords entered at the system level can be decrypted. If a common parameter is defined as a password, encrypted information may be obtained and such information fails to be decrypted. |
Parameter type. |
description |
No |
String |
The value must be 0 to 255 characters long. |
Parameter description information. |
default |
No |
String |
When creating a stack, you can enter a value to replace the default value. If no default value is set, you must enter the value of this parameter.
NOTICE:
The default value type must be the same as the defined parameter type. If they are inconsistent, the parser may perform automatic conversion, resulting in an unexpected result. |
Default parameter value. |
label |
No |
String |
The value is a string of 0 to 64 characters. |
Label of a parameter. The label defined here can be displayed by category during stack creation. |
constraints |
No |
String |
There are several constraints. You can define only one rule for each condition of an input parameter. If any of the constraints is not met, the parameter is considered invalid.
|
Parameter constraints, which are used to restrict the valid value range of an input parameter. |
invisible |
No |
- |
When invisible of an input parameter is set to true, ****** is displayed. |
Whether the output is visible. |
Example configuration of inputs:
tosca_definitions_version: huaweicloud_tosca_version_1_0 inputs: # defines the variables of a stack created based on a template. instance: description: number of Elastic Cloud Servers (ECSs) to be created default: 1 image: description: ID of the image used by the ECS type: HuaweiCloud.ECS.Image.Id vpc: description: ID of the Virtual Private Cloud (VPC) to which the ECS belongs subnet: description: ID of the subnet to which the ECS belongs
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.