Skip to content

Terraform

You can use our Terraform or OpenTofu provider to automate the configuration of your application on Nexaa.

Both Terraform an OpenTofu have all features we provide on our platform. We made the source code of the provider open source for maximum transparenty. But also to allow you to help us improve the provider. If you found a bug simply report it in our github repo.

Getting started

To start using Terraform/OpenTofu you need to install their binaries on your deployment system. You can consult their docs to read how to do this for your system.

Note

You can select one of the tools, depending on your needs. Terraform is a commercial product provided by Hashicorp. OpenTofu is an opensource alternative compatible with Terraform. The right tool matches with your experience and license needs.

Once you have your tool installed you can start to create your first resources.

Create a file named main.tf in your project directory with the following content.

terraform {
  required_providers {
    nexaa = {
      source = "nexaa-cloud/nexaa"
      version = "~> 0.1"
    }
  }
}

provider "nexaa" {
  username = var.nexaa_username
  password = var.nexaa_password
}

In this example we use variables to make sure we never commit our secrets, so we need to create a variables.tf file as well.

variable "nexaa_username" {
  description = "Username for Nexaa authentication"
  type        = string
  sensitive   = true
}

variable "nexaa_password" {
  description = "Password for Nexaa authentication"
  type        = string
  sensitive   = true
}

Once this is done you can initialize the project and create your first resource. Initializing will download the nexaa provider to your system.

tofu init
terraform init

Recommendations

As both Terraform and OpenTofu are depending on local state we recommend to store this state at a central place so your team is always using the same state. This avoids issues when applying new changes to your setup. Please consult the OpenTofu docs how to do this.