Brainboard's documentation
Go to the app ↗
  • Welcome
  • Getting started
    • Fast track
    • Start with a template
    • Start with AI
    • Use cases videos
    • Brainboard philosophy
  • Cloud design
    • Left bar
      • Cloud resources
      • Input & output
    • Design area
      • Node
      • ID card
      • Connectors
      • Versioning
      • Graphical options
    • One action
    • Code Edition
  • Data
    • Data structure
      • Project
      • Environment
      • Cloud architecture
        • Terraform files
        • Readme file
        • Architecture Synchronization
        • Remote backend
      • Template
    • Cloud providers
      • Supported cloud providers
      • Customize provider configuration
      • Unsupported cloud providers
    • Terraform / OpenTofu
      • Modules
        • Module
        • Import modules
        • Manage module
        • Terraform registry credentials
        • Use modules
    • Disaster recovery
  • Automation
    • CI/CD engine
    • Supported plugins
      • Terraform
      • Security
        • Trivy
        • Tfsec
        • Terrascan
        • OPA
        • Checkov
      • Infracost
      • Notifications
        • Email
        • Slack
        • Microsoft Teams
      • Webhooks
    • Pipelines
    • Workflow templates
    • Drift detection
      • Types of drift
      • Remediation
    • Self-Hosted Runner
      • Deploy runner with Kubernetes
      • Deploy runner with docker-compose
  • Settings
    • Overview
    • Authentication
      • Login into Brainboard
      • Single sign-on (SSO)
    • Account management
    • Organization
    • Members
    • Teams
    • Roles & Permissions (RBAC)
      • Level of access
      • Organization RBAC
      • Project RBAC
    • Integrations
      • Git configuration
        • GitHub
        • Azure DevOps (ADO)
        • Bitbucket
        • GitLab
        • How to use
      • Cloud providers
        • AWS
        • Azure
        • GCP
        • OCI
  • Security
    • Data managed by Brainboard
    • SOC 2 Type II
    • Role Based Access Control
  • Help & FAQ
    • Shortcuts
    • FAQ
    • Migration
      • Import from cloud provider
    • Support
    • Glossary
  • Changelog
Powered by GitBook
On this page
  • Description
  • Files structure
  • Create new Terraform file
  • Rename existing Terraform file
  • Delete a Terraform file
  • Add resource into an existing file
  • Remove resource from a file
  • Best practices

Was this helpful?

Edit on GitHub
  1. Data
  2. Data structure
  3. Cloud architecture

Terraform files

PreviousCloud architectureNextReadme file

Last updated 8 months ago

Was this helpful?

Description

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 change rename or change the generated files, you have the following ones:

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

  2. output.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 new Terraform file

To create a new Terraform file that contains some resources:

  1. Select the resource you want to put in the same file.

  2. Click on Group resource in the same Terraform file button:

  3. Give a new name of the file.

  4. Click on Save to create the new file and put resources inside it.

Once the file is created, it will be visible in the list of Terraform files:

Rename existing Terraform file

To rename an existing file:

  1. Click on the button to display the list of groups:

  2. Click on the name of the group:

  3. Rename it and save.

Delete a Terraform file

To delete an existing file:

  1. Click on the button to display the list of groups:

  2. Click on the Delete group button:

  3. Confirm to permanently delete it.

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 a resource into an existing or new Terraform file (group):

  1. Select the resource.

  2. Click on the Group resource in the same Terraform file button:

  3. Either select group from the available list or create a new one.

  4. Click on Save to persist the change.

Remove resource from a file

To remove a resource from an existing Terraform file (group):

  1. Select the resource.

  2. Click on the Group resource in the same Terraform file button:

  3. Select main.

  4. Click on Save to persist the change.

Best practices

  • Always group resources that are supposed to work together or have the same logic in a separate group / Terraform file.

  • Use explicit names for your Terraform files. Usually, there are 2 conventions of naming:

    • Infrastructure base naming: vpc.tf, db.tf...

    • Application base naming: microservice1.tf, backend.tf...