# 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**

&#x20;It represents a cloud resource for a given provider for which Brainboard generates the `resource` Terraform block.

<figure><img src="/files/5D5iw1AJdKBwUI4tvLq2" alt="" width="375"><figcaption></figcaption></figure>

#### **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.&#x20;

<figure><img src="/files/O4HbEFwaZKcswuMPtL61" alt="" width="375"><figcaption></figcaption></figure>

#### **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.

<figure><img src="/files/dHLgUOfoKfQ5T2JbSm4Z" alt=""><figcaption></figcaption></figure>

#### **4. Container**

This node is supposed to contain other resources and pass some of its cloud or graphical configurations to its children.

1. **Azure example**

When you add an **AKS cluster** to the resource group, it automatically inherits the `resource_group_name` from the RG.&#x20;

<figure><img src="/files/x0x2QWAGpbE5wWSVAlnR" alt=""><figcaption></figcaption></figure>

2. **AWS example**

When you add an internet gateway to the VPC, it inherits the `vpc_id` automatically from the VPC.

<figure><img src="/files/QiH45uCPEgIXx2A0F1KD" alt=""><figcaption></figcaption></figure>

3. **GCP example:** When you add compute firewall into a compute network, it inherits its `network` automatically

<figure><img src="/files/49WjMCzvLxU90GOdUlGO" alt=""><figcaption></figcaption></figure>

{% 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.

![](/files/Mepj1ZZUr8G5jTqJE3G4)
{% endhint %}

4. **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

<figure><img src="/files/veytj62gCD51esvbocm9" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/ICslluVoqX862LeiK5Op" alt="" width="488"><figcaption></figcaption></figure>

5. **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.

<figure><img src="/files/cbbl2tl5BLj1Kc61rE4m" alt="" width="329"><figcaption></figcaption></figure>

6. **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.

<figure><img src="/files/HWXTGJT4hT2nqFyOkZoZ" alt=""><figcaption></figcaption></figure>

1. **Order:** Change the z-index of the node.

<figure><img src="/files/yIKhsK4vOPeAYoMl5cBM" alt="" width="447"><figcaption></figcaption></figure>

<table><thead><tr><th width="74.48138427734375">#</th><th width="203.13238525390625">Oorder</th></tr></thead><tbody><tr><td>a</td><td>Send backwards</td></tr><tr><td>b</td><td>Send to back</td></tr><tr><td>c</td><td>Bring to front</td></tr><tr><td>d</td><td>Bring forward</td></tr></tbody></table>

<table><thead><tr><th width="74.48138427734375">#</th><th width="203.13238525390625">Oorder</th></tr></thead><tbody><tr><td>a</td><td>Send backwards</td></tr><tr><td>b</td><td>Send to back</td></tr><tr><td>c</td><td>Bring to front</td></tr><tr><td>d</td><td>Bring forward</td></tr></tbody></table>

2. **Align:** This option allows you to align multiple nodes. You must select all the nodes that you need to align.&#x20;

<figure><img src="/files/UPVP87mMm3NBcCGNX9oU" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="74.48138427734375">#</th><th width="477.2064208984375">Alignment</th></tr></thead><tbody><tr><td>a</td><td>Align nodes left</td></tr><tr><td>b</td><td>Align vertically nodes' centers</td></tr><tr><td>c</td><td>Align nodes right</td></tr><tr><td>d</td><td>Align nodes to the top</td></tr><tr><td>e</td><td>Align horizontally nodes' centers</td></tr><tr><td>f</td><td>Align nodes on the bottom</td></tr><tr><td>g</td><td>Distribute space between nodes vertically</td></tr><tr><td>h</td><td>Distribute space between nodes horizontally</td></tr><tr><td>i</td><td>Tidy up nodes</td></tr></tbody></table>

3. Change the **background colour** of the node.
4. Change the **text colour** of the node.
5. Change the **border colour** of the node.
6. Change the **border radius of the node.**
7. Make the **borders of the node dashed.**
8. Change the **border weight** of the node.
9. **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

1. **Resource, data source and container**

These 3 types of nodes share the same options in their context menu.

<figure><img src="/files/7Gjx2fuREtU5kHTAzkqt" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="58.92578125">#</th><th width="684.6141357421875">Menu item</th></tr></thead><tbody><tr><td>a</td><td>Open the Resource Configuration panel to update the cloud configuration.</td></tr><tr><td>b</td><td>Switch the resource into data and vice versa.</td></tr><tr><td>c</td><td>Change the title of the node.</td></tr><tr><td>d</td><td>This allows you to lock/unlock the node graphically, which means it cannot be moved, resized, deleted or modified.</td></tr><tr><td>e</td><td>❓❓</td></tr><tr><td>f</td><td>Duplicate the node.</td></tr><tr><td>g</td><td>❓❓</td></tr><tr><td>h</td><td><p>Disable the Terraform code generation of the node without deleting it from the design</p><p>You can enable the code by right-clicking on the resource and choosing the option <code>Add to code</code></p></td></tr><tr><td>i</td><td>Delete the node from the design and the generated code.</td></tr></tbody></table>

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

<figure><img src="/files/4uR9LvtrrELPrVrm8QZo" alt="" width="393"><figcaption></figcaption></figure>

***

### 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](/cloud-design/right-panel/resource-configuration.md) 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 <mark style="color:$primary;">**cloud knowledge**</mark> and is able to understand the relationships and links between resources.

Explained below is the behaviour of the node in the design area.

1. A <mark style="color:$primary;">node</mark> can be selected when you click on its **Terraform** code in the right pane.
2. <mark style="color:$primary;">Nodes</mark> 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 %}

3. <mark style="color:$primary;">Containers</mark> can pass their cloud properties to their <mark style="color:$primary;">children</mark> when **Terraform** supports it.

{% hint style="info" %}
Brainboard can detect what should be passed and how, and then generate the right code.
{% endhint %}

4. When you update the `resource name` of any <mark style="color:$primary;">node</mark> at any level, Brainboard automatically updates all the nodes that depend on it with the **new name.**
5. A <mark style="color:$primary;">container</mark> cannot be resized smaller than its children. It has to visually indicate the children contained.
6. There is <mark style="color:$danger;">**no**</mark> inheritance between resources of different providers.

{% hint style="info" %}
For example, you cannot add an `aws_subnet` inside `azurerm_virtual_network`.
{% endhint %}

7. Within the same provider, you <mark style="color:$danger;">**cannot**</mark> 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 %}

8. When you try to add a <mark style="color:$primary;">container</mark> 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 %}

9. 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 %}

10. 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.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.brainboard.co/cloud-design/design-area/node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
