Template Middleware Parameters

Managed services variables are definitions of variables that are presented to the deployer when a Template is deployed. This section will describe the format and uses of these variables.

Managed services variables provide the opportunity for an administrator to hardcode certain values for a parameter and make them relevant for a specific organization. Additionally, the deployment properties of variables may be modified to make it suitable for a specific situation.

Managed services variables may be accessed and edited from the Templates tab in the Template Editor.

From GIT, the camvariables.json file describes a set of Managed services variables for a specific template.

Managed services Variables example

The following example shows a sample Managed services variable as it is described in the Parameters section of the Template Editor. To understand the context of this variable, the Terraform template must be inspected.

python
  {
    "name": "referenced-image-image",
    "type": "string",
    "description": "referenced-image OS Image",
    "default": "RHEL-7.3_HVM_GA",
    "hidden": false,
    "label": "referenced-image Image",
    "secured": false,
    "system": false,
    "required": true,
    "immutable": false
  }

This example describes an input variable to a Terraform Template that gets interpreted by Managed services when the template is deployed.

Managed services variables structure

The following is the meta-structure of a Managed services variables file, this in general represents the different sections contained within the file.

Section Definition
input_datatypes input_datatypes are a collection of attributes. This section defines one or more input_datatypes collections to inject to the template at deploy time the most common being advanced_content_runtime_chef. <\br> You can also use input_datatypes to define Data Types.
output_datatypes After deployment, the this section defines the name of the namespace to be updated post deployment.
input_groups Variables are divided into logical groups. One such use of variable groups is to more efficiently display variables to a deployer in a logical format. This section defines one or more Input Groups associated with a Template.
output_groups This section defines one or more Output Groups associated with a Template.
template_input_params Templates will accept one or more parameters in order to deploy. As a general rule, these parameters will help populate the Terraform Variables (.tfvars) file. The input parameters define a list of parameters to be inputted to the Terraform Template during the deployment process. The field definition will dictate how CAM handles these variables at deploy time. <\br> If you want to get a value from datatype, then you can define the default value, for example, "default": "${datatypedemo1.ipaddress}", where datatypedemo1 is the name of the datatype and ipaddress is the attribute.
template_output_params A list of variables calculated during the deployment process and stored for future reference.

Input Parameter Definition

The following are the relevant field definitions for defining Input Parameters:

Field Definition
name The name of the service parameter.
label The label to be displayed in the user interface for this parameter
description A description for this parameter.
type The type of parameter. E.g. "list, string, map.
default The default value of the parameter. An example default value for shared parameter is "default": "${datatypedemo1.ipaddress}", where datatypedemo1 is the name of the Data Type and ipaddress is an attribute.
hidden Specify if the parameter is not displayed in the user interface. The value must be true or false.
immutable Specify if the parameter is read only. The value must be true or false.
immutable_after_create Specify a value and deploy it for the first time. You cannot edit it in subsequent plan changes. The value must be true or false.
required Specify if the parameter is required. The value must be true or false.
secured Specify if the parameter value is shown as **. The value must be true or false.
regex Define the regular expression (regex) - ^[A-Za-z0-9-]{1,52}$. The value you provide must match this regular expression.
group_name The group to locate this parameter in when displaying on the UI" E.g. "myGroup".
options in place of "default" for a list to select from

Output Parameter Definition

The following are the relevant field definitions for defining Output Parameters:

Field Definition
name The name of the service parameter.
label The label to be displayed in the user interface for this parameter
description A description for this parameter.
type The type of parameter. E.g. "list, string, map
hidden Specify if the parameter is not displayed in the user interface. The value must be true or false.
secured Specify if the parameter value is shown as **. The value must be true or false.
return_type The type of the parameter that is returned.
group_name The group to locate this parameter in when displaying on the UI" E.g. "myGroup".

Relationship to templates

Generally, Managed services variables directly relate to the parameters exposed in a Terraform template. Managed services variables are used by Managed services to inject Terraform parameters at deploy time.