All Products
Search
Document Center

Cloud Architect Design Tools:Configure template variables

Last Updated:Aug 15, 2024

Configure local variables

  1. 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.image

  2. 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.image

  3. Click fx. The dialog box for defining the variable appears. The following table describes the configuration items.image

    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.

  4. In this example, configure the count and instance name variables of ECS.imageimage

Important

When you configure local variables, the values of the Variable Value and Placeholder attributes must be the same.

Configure global variables

Note

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.

ecs1

  1. 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.image

  2. In the Custom Variable dialog box, click Add Global Variable. Configure a global variable in the same way as configuring local variables.全局变量1全2全3

  3. Modify the local variables. After you use a hyphen (-) to add or append the global variable to a local variable, save the configuration.前1yq2

    Important

    Global 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.

  4. Specify the name of the instance created based on the template.

ecs11kafka11

Note

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

  1. 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.image

  2. 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.image

Delete a template variable

To delete a template variable, you can use one of the following methods:

  1. In the dialog box for viewing template variables, find the variable that you want to delete and click Delete in the Action column.image

  2. In the dialog box for defining a variable, click Delete Current Variable to delete the current variable.image