For the complete documentation index, see llms.txt. This page is also available as Markdown.

Terraform files

Overview

When you create your architecture, Brainboard automatically and instantly generates a Terraform code for your infrastructure.

This code is stored in different files according to the best practices of Terraform.

Files structure

By default, if you don't rename or change the generated files, you have the following ones:

  1. main.tf: contains all the definitions of resources and their configuration. See how you can change or rename it below.

  2. outputs.tf: contains the output variables.

  3. providers.tf: contains the definition of terraform block and the providers.

  4. terraform.tfvars: contains only the values of the variables if defined.

  5. variables.tf: contains the definition of variables and their blocks.

  6. locals.tf: contains the definition of Terraform locals.

  7. backend.tf: contains the configuration of the remote backend.

Create a new Terraform file

To create a new Terraform file that contains some resources:

  1. Using click and drag, select the resource you want to put in the same file and right-click to open the menu. Select Move to file.

  2. On the Edit terraform file name modal, assign a name (without .tf extension) to the new file you are about to create. Click Save.

Once the file is created, it will be visible in the list of Terraform files in the right menu. Or, you can also access the newly created Terraform file using the hamburger icon given at the bottom next to the right pane.

Rename existing Terraform file

To rename an existing file:

  1. Click the hamburger icon at the bottom right to view the list of available Terraform files.

  2. Click on the file that you want to rename.

  3. Edit the file name as per your requirement.

  4. Click the tick mark icon given next to the editable field. The Terraform file name will be updated accordingly.

  1. Rename it and save.

Delete a Terraform file

To delete an existing file:

  1. Click on the hamburger icon to display the list of existing Terraform files in your architecture.

  2. Click on the bin icon next to the unwanted file.

  3. On the Delete File confirmation popup, enter the complete file name (including the .tf extension) as instructed.

  4. Click Delete File.

When you delete a group, the resources inside it will not be deleted. They will be put back in main.tf. To delete them, you need to select and delete them

Add resource into an existing file

To add one or more resources into an existing Terraform file, follow these steps:

  1. Using click and drag, select the resource/resources you want to put in the same file and right-click to open the menu.

  2. Select Move to file.

  3. On the Edit terraform file name modal, select the file from the dropdown list.

  4. Click Save.

Remove resource from a file

To remove a resource from an existing Terraform file:

  1. Select the resource, and right-click to open the shortcut menu.

  2. Select Move to file.

  3. On the Edit terraform file name modal, select main from the dropdown list.

  4. Click Save.

Best practices

lightbulb-gear
lightbulb-gear

Last updated