Node
Overview
The node is the graphical object you use to build your cloud infrastructure and is the building block of the architecture.
{% hint style="success" %} When you drag and drop a node from the left panel into the design area, you can customize both its graphical aspects and its cloud configuration to generate its Terraform code. {% endhint %}
Types of nodes
1. Resource
It represents a cloud resource for a given provider for which Brainboard generates the resource Terraform block.
.png)
2. Data source
This is a read-only object that allows you to reference an existing cloud resource. Brainboard generates the data Terraform block for it.
The data block is indicated with a cube on its left.
.png)
3. Icon only
This object is used to depict a graphical component that doesn't have a Terraform code, but has a meaning in the architecture.
.png)
4. Container
This node is supposed to contain other resources and pass some of its cloud or graphical configurations to its children.
- Azure example
When you add an AKS cluster to the resource group, it automatically inherits the resource_group_name from the RG.
.png)
- AWS example
When you add an internet gateway to the VPC, it inherits the vpc_id automatically from the VPC.
.png)
- GCP example: When you add compute firewall into a compute network, it inherits its
networkautomatically
.png)
{% hint style="info" %} Brainboard group
- This is a special container of resources that has a title and icon that you can customize.
- It supports nested containers.
{% endhint %}
- Module
This node represents a Terraform module for which Brainboard generates a module block.
By default, when you can a module, it is represented by a simple node containing the icon of the provider of the resources
.png)
You can change any module into a container, by right-clicking on it and select Switch to container. You can turn it back into a node by right click and select Switch to node.
.png)
- Shape
This is a pure graphical object that helps you depict information that don't have a Terraform code.
Some shapes can also be containers, like rectangles and circles, which helps you group your resources without triggering cloud configuration inheritance.
.png)
- Text
This node helps create a text object to add complementary information to your cloud architecture.
Graphical options
Options bar
The following graphical options are common to any node in the design area.
.png)
- Order: Change the z-index of the node.
.png)
| # | Oorder |
|---|---|
| a | Send backwards |
| b | Send to back |
| c | Bring to front |
| d | Bring forward |
| # | Oorder |
|---|---|
| a | Send backwards |
| b | Send to back |
| c | Bring to front |
| d | Bring forward |
- Align: This option allows you to align multiple nodes. You must select all the nodes that you need to align.
.png)
| # | Alignment |
|---|---|
| a | Align nodes left |
| b | Align vertically nodes' centers |
| c | Align nodes right |
| d | Align nodes to the top |
| e | Align horizontally nodes' centers |
| f | Align nodes on the bottom |
| g | Distribute space between nodes vertically |
| h | Distribute space between nodes horizontally |
| i | Tidy up nodes |
- Change the background colour of the node.
- Change the text colour of the node.
- Change the border colour of the node.
- Change the border radius of the node.
- Make the borders of the node dashed.
- Change the border weight of the node.
- Open cloud configuration: This will open the Resource Configuration panel that contains all Terraform fields that you can fill. Brainboard generates the Terraform code based on this configuration.
Context menu
- Resource, data source and container
These 3 types of nodes share the same options in their context menu.
.png)
| # | Menu item |
|---|---|
| a | Open the Resource Configuration panel to update the cloud configuration. |
| b | Switch the resource into data and vice versa. |
| c | Change the title of the node. |
| d | This allows you to lock/unlock the node graphically, which means it cannot be moved, resized, deleted or modified. |
| e | ❓❓ |
| f | Duplicate the node. |
| g | ❓❓ |
| h | Disable the Terraform code generation of the node without deleting it from the design You can enable the code by right-clicking on the resource and choosing the option |
| i | Delete the node from the design and the generated code. |
- Module
All the options are similar to the resource, except that for modules, you have the possibility to switch a module visually into a container and switch it back into a normal node if needed.
.png)
Cloud configuration
Every node that is a cloud resource will have its Terraform code automatically generated and updated when you fill in the information in the Resource Configuration panel or when you move the node into a parent, where it inherits some cloud properties.
{% hint style="info" %} Refer to the Resource Configuration page for more details about how to update the cloud configuration of nodes and all the options available. {% endhint %}
Behavior
Brainboard design area is a smart canvas that has cloud knowledge and is able to understand the relationships and links between resources.
Explained below is the behaviour of the node in the design area.
- A node can be selected when you click on its Terraform code in the right pane.
- Nodes can be linked to each other automatically when you reference a Terraform attribute from one node to another.
{% hint style="info" %} The name of the field that references the other node is put in the text of the connector created between both resources. {% endhint %}
- Containers can pass their cloud properties to their children when Terraform supports it.
{% hint style="info" %} Brainboard can detect what should be passed and how, and then generate the right code. {% endhint %}
- When you update the
resource nameof any node at any level, Brainboard automatically updates all the nodes that depend on it with the new name. - A container cannot be resized smaller than its children. It has to visually indicate the children contained.
- There is no inheritance between resources of different providers.
{% hint style="info" %}
For example, you cannot add an aws_subnet inside azurerm_virtual_network.
{% endhint %}
- Within the same provider, you cannot do what is not allowed by the provider.
{% hint style="info" %} For example, you cannot add a subnet inside a subnet, VPC inside VPC, VNET inside VNET... {% endhint %}
- When you try to add a container into another one, Brainboard automatically fixes the right order of containers based on what is accepted by the provider.
{% hint style="info" %} For example, if you try to add a VPC inside a subnet, Brainboard will put the subnet inside the VPC and fill the information correctly for you. {% endhint %}
- You can still reference resources from different providers in the Resource Configuration panel.
{% hint style="info" %} For example, reference an AD user inside a VM. {% endhint %}
- When selecting multiple resources and cloning them, Brainboard automatically generates new resource names to avoid collisions and tracks dependencies correctly. Which means the Terraform plan should pass after the clone.