Input & output
Overview
When you design your cloud infrastructures in Brainboard, the Terraform code is auto-generated for you based on the configuration of the resources.
Brainboard allows you to use variables, locals and output exactly as you would do it in Terraform.
You can implement your naming conventions, set specific values for the configuration based on some criteria and define what information you want to display once the infrastructure is deployed.

Variables
In Terraform, a variable is a way to store and reuse values throughout your Terraform code, and it is defined using the variable block.
When you click on the Variable button available in the left panel, it opens the Variables window.
Brainboard follows Terraform best practices, so by default, when you create a new architecture, Brainboard automatically adds a variable called tags which is added in the generated Terraform code of every resource that supports tagging.
Action items on the Variables window
Shared below is the screenshot of the Variables window, numbered with action items/features available on this screen, followed by their brief description.

1
Add Variable
To create a new variable. (Explained in detail below).
2
Search bar
To search for a specific variable on the Variables window. Keyword search is supported.
3
Switch view
Using these buttons, you can switch between a detailed and a compact view of the variables list.
4
Sorting variables list
You can sort the list of variables according to ascending or descending order of their names, as well as in ascending/descending order of the date when they were last updated.
5
Scope view
The scope selector allows you to view variables that are defined in every scope or display all variables of all scopes.
6
Variable list
By default, the variables list is displayed in the"detailed view", which shows more information about variables than just names.
Creating a new variable
To create a new variable, click on the Add Variable button on the Variables window, and a form will appear on the right side of the screen (explained below the screenshot).

On the "create new variable" form, you can specify the following information:
Name of the variable: This is the name that you'll use to reference the variable when you use it.
It follows the naming conventions of Terraform, for example, it doesn't support spaces, or starting with a number.
Best practice: use clear and explicit names and separate words with underscore _.
Scope: You can set the level where you want this variable to be available.

The four levels of scopes are listed in the order of "least shared or restrictive to more shared / available/"
There is an override mechanism if the same variable is defined in multiple scopes.
Architecture
Variables that are defined with this scope are only available within this architecture only.
If the same variable is defined in another level as well, the default or values defined at the architecture level overrides any other level.
Environment
Variables defined at the environment level are available to all architectures within the same environment.
Variables defined in this level override those defined at project and organization level.
Project
Variables defined at the project level are available to all environments and architectures within the same project.
Variables defined in this level override those defined at the organization level.
Organization
Variables defined at the organization level are available to all architectures, environments and project within the organization.
Description: It should concisely explain the purpose of the variable and what kind of value is expected. This description string might be included in documentation about the module, and so it should be written from the perspective of the user of the module rather than its maintainer.
Variable type: This allows you to restrict the type of value that will be accepted.
If no type constraint is set then a value of any type is accepted.
While type constraints are optional, we recommend specifying them; they can serve as helpful reminders for users of the module, and they allow Terraform to return a helpful error message if the wrong type is used.
The supported type keywords are: any bool list map number object set string tuple

Default value: If present, the variable is considered to be optional and the default value will be used if no value is set.
Value: The value that will be used during Terraform execution and if defined, it overrides the default value.
This value will be put in the file
terraform.tfvars.If you convert the architecture into a template or clone the architecture, this value will be removed.
Sensitive: Setting this flag prevents Terraform from showing its value in the
planorapplyoutput and Brainboard will store the variable in a separate vault.
Even if the variable is flagged sensitive, its value will still be stored in clear text in the Terraform state.
Validation: You can specify custom validation rules for the variable.
For every variable defined, Brainboard creates a variable block in the file variables.tf.
Refer to the RBAC (Role Based Access Control) documentation page to understand how you can manage permissions to restrict/allow members and teams to add, update or delete variables.
Locals
A local value assigns a name to an expression, so you can use the name multiple times within a module instead of repeating the expression.
Brainboard allows you to define multiple locals.
When you define locals in Brainboard, they are added to the locals.tf file and in the same block locals

The table of locals is similar to the one of variables detailed above. Please refer to it to understand the different components of the user interface.
Creating a new local
Click on the Add local button to open the modal that allows you to specify the Name, Description and Value of the local.

If you are using a complex expression in the value field, you need to quote it as you can mix strings, functions, variables....
Outputs
Output values make information about your cloud infrastructure available on the command line and will be displayed in the output of execution.

The table of output is similar to the one of variables detailed above. Please refer to it to understand the different components of the user interface.
Creating an output
Click on the Add output button to open the modal that allows you to specify the Name, Description and Value of the output.

For every output defined, Brainboard creates an output block in the file outputs.tf.
Last updated