> ## Documentation Index
> Fetch the complete documentation index at: https://help.dsalta.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Terraform

> Infrastructure as Code — org access, workspaces & runs

<Tabs>
  <Tab title="Overview">
    Connect Terraform Cloud / HCP Terraform with an API token to sync organization members, workspaces, runs, and security-relevant audit events, and run access reviews. Read-only; the token is held by Nango.

    <Info>
      **Read-only access.** DSALTA only reads data from this integration. It never creates, modifies, or deletes anything in your environment, and every remediation step is performed by your team directly in the third-party product.
    </Info>

    <Note>
      DSALTA collects this integration's data when you connect it — you can refresh it at any time with **Sync from integrations** on the **Integrations** page. The compliance checks below re-run once a day at 02:00 America/New\_York.
    </Note>

    ## What DSALTA reads

    DSALTA reads your Terraform organization memberships — email address, status and join date — which appear on your **Access** page; your workspaces, which appear on your **Inventory** page; your organization's runs, which appear on your **Changes** page; and a filtered slice of the organization audit trail covering authentication and OAuth tokens, SAML configuration, membership changes, forced runs and policy overrides, which appears on your **Incidents** page. State files, variables and variable values are never read. The **Incidents** page requires a plan that includes audit trails (Standard or Premium) and an organization token.

    It calls these Terraform endpoints:

    * `/api/v2/organizations`
    * `/api/v2/organizations/{org}`
    * `/api/v2/organizations/{org}/organization-memberships`
    * `/api/v2/organizations/{org}/teams`
    * `/api/v2/organizations/{org}/workspaces`
    * `/api/v2/organizations/{org}/runs`
    * `/api/v2/organization/audit-trail`

    Every request is a read. DSALTA has no code path that creates, modifies, or deletes anything in your Terraform environment.

    ## Troubleshooting

    <AccordionGroup>
      <Accordion title="The Incidents page is empty">
        The audit trail requires a Standard or Premium plan and an organization token created under **Organization Settings → API Tokens**. Only token, SAML, membership, forced-run and policy-override events are recorded as incidents.
      </Accordion>

      <Accordion title="The MFA check fails even though every member has 2FA turned on">
        That check reads the organization's `collaborator-auth-policy`, not per-user enrolment. It passes only when the policy is set to require two-factor authentication for all collaborators — members who enrolled individually do not make it pass.
      </Accordion>
    </AccordionGroup>

    <AccordionGroup>
      <Accordion title="How do I check whether the connection is healthy?">
        Open **Integrations** in the DSALTA sidebar, stay on the **Connected** tab, and click **Manage** on the integration's card. Open the **Status** tab: it shows either **Connected and working properly** or **Connection issues detected**.

        Use the **Status** tab, not **Overview** — Overview always reports **Connected** regardless of the real state.
      </Accordion>

      <Accordion title="A check shows Failed and nothing changed on my side">
        On an integration-powered check, **Failed** normally means DSALTA was blocked rather than that you are non-compliant. Open the test, go to **Source Data**, and read the result code: **403** is a missing permission, **428** is a setting DSALTA still needs, **500** is a failure on DSALTA's side.

        A real compliance gap shows **207** and leaves the test looking **Completed**. See [Understanding Test Results](/guides/data-library/test-results).
      </Accordion>

      <Accordion title="Data looks out of date">
        Compliance checks re-run once a day at 02:00 America/New\_York. To refresh sooner, open **Integrations → Connected** and click **Sync from integrations** at the top right — it refreshes every connected integration at once.
      </Accordion>

      <Accordion title="How do I repair a broken connection?">
        There is no Reconnect, Repair or Refresh Token button. The only repair available is to disconnect and connect again.

        <Warning>
          **Disconnecting is destructive and cannot be undone.** DSALTA removes the access records, inventory, vulnerabilities, code changes, incidents and device records collected from this integration, and deletes the test results tied to the connection. Export anything you still need as audit evidence first — see [Integration errors](/troubleshooting/integration-errors).
        </Warning>
      </Accordion>

      <Accordion title="Configure scope will not let me change anything">
        That is expected. **Configure scope** is read-only — it shows what DSALTA is permitted to read, and has no Save action. To change what DSALTA can see, change the permissions on the credential in the third-party product, then disconnect and connect again.
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="How to connect">
    A Terraform API token, entered in Nango's secure window. Read-only.

    **Before you begin**

    * A Terraform Cloud / HCP Terraform organization
    * Permission to create an API token under **Organization Settings → API Tokens** (an organization token — recommended) or **User Settings → Tokens** (a personal token)
    * For the **Incidents** page only: a plan that includes audit trails (Standard or Premium).

    You will need:

    | Field         | Where to find it                                     | Example                            |
    | ------------- | ---------------------------------------------------- | ---------------------------------- |
    | **API token** | Terraform Cloud → Organization Settings → API Tokens | `Shown once, right after creation` |

    <Steps>
      <Step title="Start in DSALTA">
        Open **Integrations** in the DSALTA sidebar, find **Terraform**, and click **Connect** to open the connect panel. Leave it open — it lists every value you need, and you create those in the steps below.
      </Step>

      <Step title="Generate a Terraform API token">
        In Terraform Cloud / HCP Terraform, go to your Organization Settings → API Tokens (or your User Settings → Tokens for a personal token), and create a new token. An organization token is recommended — it isn't tied to one person's account.

        <Tip>
          An organization token is also required for the **Incidents** page — the audit-trail endpoint DSALTA reads is organization-token scoped.
        </Tip>
      </Step>

      <Step title="Copy the token immediately">
        Terraform only shows the full token once, right after creation. Copy it somewhere safe — you'll paste it into the next step. DSALTA only reads data (organizations, memberships, workspaces, runs, audit trail) and never modifies your Terraform configuration.
      </Step>

      <Step title="Connect Terraform">
        Back in the connect panel, click through to the **Connect Terraform** step and enter your Terraform credentials in the secure Nango window. DSALTA never stores them directly — it keeps only a connection reference, and the token itself is held by Nango.
      </Step>
    </Steps>

    <Check>
      DSALTA validates the credential as soon as the Nango window closes, by calling `/api/v2/organizations` to confirm the token can see an organization. On success the integration moves to the **Connected** tab, and **Manage → Status** reads **Connected and working properly**. Checks begin reporting after the first sync.
    </Check>

    <Warning>
      **If the connection is rejected.** The token is invalid or revoked, or it can see no organization at all.

      The on-screen message is generic — see [Connection error messages](/troubleshooting/connection-error-messages).
    </Warning>
  </Tab>

  <Tab title="Automated checks">
    Each check below re-runs once a day, at 02:00 America/New\_York, while this integration is connected. Click any check for step-by-step remediation guidance.

    | Check                                                                                                                    | Severity | What it verifies                                                                                  |
    | ------------------------------------------------------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------- |
    | [User access to Critical System should be valid](/integrations/terraform/user-access-to-critical-system-should-be-valid) | Info     | Checks that everyone with Terraform organization access is an active employee on the People page. |
    | [Offboarded users should not have active access](/integrations/terraform/offboarded-users-should-not-have-active-access) | High     | Checks that offboarded employees no longer have active Terraform organization access.             |
    | [MFA should be enabled for all users](/integrations/terraform/mfa-enabled-for-all-users)                                 | High     | Checks that the Terraform organization enforces two-factor authentication for all collaborators.  |
  </Tab>

  <Tab title="Useful links">
    | Topic   | Link                                                                    |
    | ------- | ----------------------------------------------------------------------- |
    | Setup   | [HCP Terraform (app.terraform.io)](https://app.terraform.io)            |
    | General | [Terraform website](https://terraform.io)                               |
    | DSALTA  | [Connection error messages](/troubleshooting/connection-error-messages) |
  </Tab>
</Tabs>
