Configure local variables
Log on to the Cloud Architect Design Tools (CADT) console. In the top navigation bar, choose Create > My solution. On the page that appears, find the template for which you want to define variables. Click Edit Template. In this example, an Elastic Compute Service (ECS) template is used.
Double-click the resource icon. In the panel that appears, define variables for the resource. The attributes that support variable definition are marked with fx.
Click fx. The dialog box for defining the variable appears. The following table describes the configuration items.
Attribute
Description
Format
Requirement
Variable Value
The variable name.
${Variable name}
"${}" is a fixed format.
The variable name can contain only letters, digits, hyphens (-), and underscores (_).
Placeholder
The placeholder.
${Variable name} and a combination of letters and digits
In most cases, the placeholder must be consistent with the value of the Variable Value attribute.
When you define a global variable, you must add the global variable name to the placeholder.
Default Value
The default value of the variable. If you do not assign a value to the variable, the default value is used for the variable.
You cannot configure default values for secondary attributes.
In this example, configure the count and instance name variables of ECS.
When you configure local variables, the values of the Variable Value and Placeholder attributes must be the same.
Configure global variables
Scenarios: A global variable can be used to configure same variables for multiple nodes at a time. For example, you can configure a global variable to add the same prefix or suffix to the names of multiple instances in a template. The following figure shows the template.
After variables are defined, find the template that you want to view on the My solution page and click View Template Variables to view its template variables.
In the Custom Variable dialog box, click Add Global Variable. Configure a global variable in the same way as configuring local variables.
Modify the local variables. After you use a hyphen (-) to add or append the global variable to a local variable, save the configuration.
ImportantGlobal variables are not bound to certain resource properties. Therefore, no placeholder is specified. When you use a global variable to assign a value to a local variable, the data types of the global and local variables must be the same.
Specify the name of the instance created based on the template.
In the preceding example, the hyphen (-) character can be replaced with any other character or string. Make sure that the character or string meets the naming conventions of instances. When you modify other local variables, the character used for concatenation is reserved.
View template variables
After variables are defined, find the template that you want to view on the My solution page and click View Template Variables to view its template variables.
You can view the details of the defined template variables.
Variable Name: the name of the defined variable.
Default Value: the default value of the variable. If you do not assign a value to the variable, the default value is used for the variable.
Variable Type: the data type of the variable. Take note of this parameter because it defines how to assign a value to the variable.
Placeholder: the placeholder of the local variable.
Delete a template variable
To delete a template variable, you can use one of the following methods:
In the dialog box for viewing template variables, find the variable that you want to delete and click Delete in the Action column.
In the dialog box for defining a variable, click Delete Current Variable to delete the current variable.