Skip to content

Prepare Terraform code

Terraform Runs use a saved workspace revision. Unsaved editor changes are not a safe delivery boundary.

Typical time
10–30 minutes
You need
A project workspace and reviewed source
Next step
Create non-apply runs

Confirm the organization, project, workspace, environment, provider, region, cloud-account link, repository settings, and execution mode. Open the Terraform editor from that workspace.

Synthetic ScrinCloud Terraform workspace header showing the Documentation workspace, AWS, and a documentation architecture.
Prepare 1 of 5 · Confirm the Terraform workspaceA synthetic workspace header confirms the workspace and cloud-provider context before you edit Terraform.

Use one approved source path:

  • Generate Draft creates a reviewable Terraform draft from the saved architecture; or
  • Import Terraform loads reviewed Terraform source.

Generation and import do not prove the code is valid, safe, complete, or approved. Review all files and reconcile unexpected resources.

Terraform editor menu showing safe Import files and Import folder options with other workspace actions.
Prepare 2 of 5 · Choose a reviewed source pathThe editor menu exposes reviewed import options alongside Terraform workspace actions.

Inspect the file tree and editor:

  1. review provider and required-version constraints;
  2. review variables, outputs, resources, modules, and data sources;
  3. confirm environment-specific values are variables, not embedded secrets;
  4. resolve syntax and editor diagnostics;
  5. inspect architecture/code sync differences where applicable; and
  6. remove state, plan, archive, log, key, credential, and environment files.
Terraform editor displaying a harmless required-version constraint and the available check tabs.
Prepare 3 of 5 · Review every Terraform fileShow a synthetic file tree, Monaco editor, and safe diagnostics without exposing infrastructure.

Choose Save All only after the file set is reviewed. Confirm the editor no longer reports unsaved changes and that revision history shows the new saved revision.

The revision is the source identity used by later runs. Editing after a plan creates a different source state and requires a new plan and approval.

Read-only Terraform revision history with a synthetic saved revision and safe restore controls.
Prepare 4 of 5 · Save the exact revisionA read-only history view shows a synthetic saved revision after the workspace is saved.

From the editor, Init prepares the approved runner context; Run plan starts a real runner-backed plan. From Runs, New run can start Format, Validate, Plan, or Policy check against the saved revision.

There is no separate Policy check button in the editor toolbar; use the Runs workflow when that action is required.

Terraform editor menu showing Format, Init, Validate, and Run plan controls before an action is started.
Prepare 5 of 5 · Choose the next runner actionThe editor action menu exposes Format, Init, Validate, and Run plan without starting a runner action.

You are ready to create runs when the intended files are saved in a latest workspace revision, diagnostics are understood, sensitive artifacts are absent, and the project/workspace/provider context is correct.

The Runs page cannot start an action without latest_revision_id. Return to the editor, review changes, and choose Save All.

Generated code differs from the architecture

Section titled “Generated code differs from the architecture”

Use the code/canvas comparison and review unsupported or code-managed resources. Do not overwrite either side until the intended source of truth is clear.

Review the safe error and runner logs. Check workspace configuration, provider connection, variables, module access, and plan limits without exposing secrets.

For every editor, file, terminal, diff, health, code-sync, and inventory control, see Use the Terraform editor.