githubEdit

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.

circle-info

Brainboard allows you to use variables, locals and output exactly as you would do it in Terraform.

circle-check

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.

circle-info

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.

#
Feature
Purpose / 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:

  1. Name of the variable: This is the name that you'll use to reference the variable when you use it.

circle-info

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

  1. Scope: You can set the level where you want this variable to be available.

circle-info

The four levels of scopes are listed in the order of "least shared or restrictive to more shared / available/"

circle-info

There is an override mechanism if the same variable is defined in multiple scopes.

Scope
Explana
No

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.

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

  2. Variable type: This allows you to restrict the type of value that will be accepted.

circle-info

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.

circle-check
  1. Default value: If present, the variable is considered to be optional and the default value will be used if no value is set.

  2. Value: The value that will be used during Terraform execution and if defined, it overrides the default value.

    1. This value will be put in the file terraform.tfvars .

    2. If you convert the architecture into a template or clone the architecture, this value will be removed.

  3. Sensitive: Setting this flag prevents Terraform from showing its value in the plan or apply output and Brainboard will store the variable in a separate vault.

circle-exclamation
  1. Validation: You can specify custom validation rules for the variable.

circle-info

For every variable defined, Brainboard creates a variable block in the file variables.tf.

circle-info

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 expressionarrow-up-right, so you can use the name multiple times within a module instead of repeating the expression.

Brainboard allows you to define multiple locals.

circle-check

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.

circle-info

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.

circle-check

Last updated