Skip to main content
The Nuon dashboard provides a Use Terraform CLI option on both the Sandbox and Terraform Component detail pages. This lets you run Terraform commands locally against the remote state managed by Nuon. It’s useful for debugging, inspecting resources, importing state, or running targeted plans.

Prerequisites

1

Install the Nuon CLI

Install the Nuon CLI if you haven’t already:
Authenticate with your account:
2

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.Terraform is deprecated on brew. Consider using Terraform version manager tfenv to install and use multiple Terraform versions locally. You can install it with:
List remote versions, install specific versions, list versions, and globally select a version
Verify your local version matches:
Running a different Terraform version can corrupt state or produce unexpected plan diffs. Use a version manager like tfenv or asdf to switch versions easily.
3

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 .tf files.For example, if your sandbox is configured with:
sandbox.toml
Then clone and enter that repo:
For a component configured with a subdirectory:
components/database.toml
Navigate to that subdirectory:

Setting Up the Backend

Click the {} Use Terraform CLI button on the lower right part of Sandbox or Component detail page in the dashboard. This opens a modal, and click the Download button to retrieve a nuon_backend.tf file containing the HTTP backend configuration for that workspace. The generated file looks like this:
nuon_backend.tf
Download this file and place it in your Terraform module directory alongside the other .tf files.

Set your Nuon API token

Retrieve your Nuon API token
Replace the three token undefined blocks in nuon_backend.tf with your org’s API token.

Initializing Terraform

Initialize the backend:
The -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:
Running terraform apply locally will modify the live install infrastructure. Use caution and prefer terraform plan for inspection.

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
This state view updates after each successful sandbox run or component deploy.