Prerequisites
Match the Terraform version
You must use the same Terraform version configured for the sandbox or component. The version is displayed on the configuration card in the dashboard.For sandboxes, this is the
terraform_version in your sandbox.toml. For components, it’s the terraform_version in the component’s .toml config.Verify your local version matches:Navigate to the Terraform source code
You must run Terraform commands from within the same Terraform module directory that the sandbox or component is configured to use. This is the directory containing your Then clone and enter that repo:For a component configured with a subdirectory:Navigate to that subdirectory:
.tf files.For example, if your sandbox is configured with:sandbox.toml
components/database.toml
Setting Up the Backend
Click the Use Terraform CLI button on the Sandbox or Component detail page in the dashboard. This opens a modal with a downloadablenuon_backend.tf file containing the HTTP backend configuration for that workspace.
The generated file looks like this:
nuon_backend.tf
.tf files.
Initializing Terraform
Set your API token and initialize the backend:-reconfigure flag is required to switch Terraform’s backend to the Nuon HTTP backend. After initialization, your local Terraform is connected to the remote workspace state.
nuon orgs api-token generates a short-lived API token scoped to your currently selected org. Make sure you’ve selected the correct org with nuon orgs select before running this command. The token is used to authenticate all Terraform backend requests (state, lock, and unlock).Running Commands
Once initialized, you can run standard Terraform commands against the workspace:Unlocking State
If a Terraform operation is interrupted (e.g., a network failure during apply), the workspace state may remain locked. You can unlock it from the dashboard using the Unlock Terraform state button on the Sandbox or Component detail page.Only force unlock a workspace if you are certain no other operation is actively running. Force unlocking a workspace in use by a running job may cause state corruption.
Viewing State in the Dashboard
The dashboard displays the current Terraform state for both sandboxes and components, organized into two tabs:- Outputs - all Terraform outputs and their current values
- Resources - all managed resources with their type, provider, mode, and attribute values