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

# Connect Terraform with API Token – StackOne Hub

> Link a Terraform account in the StackOne Hub using API Token. End-user guide to authorize the integration and start using Terraform actions.

<Warning>Admin or Owner privileges are required in your Terraform account to generate API tokens.</Warning>

<section data-guide-section data-guide-scopes="">
  <h2>Determine Your Terraform Host</h2>

  <p>Identify your Terraform instance URL based on your deployment type.</p>

  <Steps>
    <Step title="Find Your Terraform Host URL">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Your Terraform Host URL depends on whether you use Terraform Cloud or Terraform Enterprise.</p>

        <ul>
          <li><strong>Terraform Cloud</strong> - Use `https://app.terraform.io`</li>
          <li><strong>Terraform Enterprise</strong> - Use your self-hosted instance URL</li>
          <li>Format: `https://{your-instance}.example.com`</li>
          <li>Example: `https://terraform.yourcompany.com`</li>
        </ul>
      </div>
    </Step>
  </Steps>
</section>

<section data-guide-section data-guide-scopes="">
  <h2>Generate an API Token</h2>

  <p>Create a user API token to authenticate with the Terraform API.</p>

  <Steps>
    <Step title="Navigate to Account Settings">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Sign in to your <a href="https://app.terraform.io" target="_blank" rel="noopener noreferrer">Terraform Cloud account</a> or your Terraform Enterprise instance.</p>

        <ul>
          <li>Click your user icon in the top-right corner</li>
          <li>Select <strong>Account settings</strong></li>
        </ul>
      </div>
    </Step>

    <Step title="Access Token Settings">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Navigate to the Tokens section.</p>

        <ul>
          <li>Click <strong>Tokens</strong> in the left sidebar</li>
        </ul>
      </div>
    </Step>

    <Step title="Create a New Token">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Generate a new API token for the StackOne integration.</p>

        <ul>
          <li>Click <strong>Create an API token</strong></li>
          <li>Enter a description (e.g., "StackOne Integration")</li>
          <li>Choose an appropriate expiration date</li>
          <li>Click <strong>Generate Token</strong></li>
        </ul>
      </div>
    </Step>

    <Step title="Copy and Store the Token">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Copy your new API token and store it securely for use later.</p>

        <ul>
          <li>Copy the token from the dialog box immediately</li>
          <li>Note: Terraform only displays the token once. If you lose it, you must revoke it and create a new one.</li>
        </ul>
      </div>
    </Step>
  </Steps>
</section>

<div data-whitelabel-hide>
  <h2>Linking the Account from the Hub</h2>

  <Steps>
    <Step title="Navigate to the Hub">
      Use one of the three <a href="/guides/accounts-section#linking-accounts">Linking Account Methods</a> to access the Hub.
    </Step>

    <Step title="Fill out the fields">
      Fill out the following fields using details from your provider:

      <ul>
        <li><strong>Terraform Host</strong></li>
        <li><strong>API Token</strong></li>
      </ul>
    </Step>

    <Step title="Connect">
      <ul>
        <li>Click <strong>Connect</strong></li>
        <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
        <li>Once authorization is successful, you will see a confirmation popup</li>
      </ul>
    </Step>
  </Steps>

  <p>If the account linking is successful, you will see the newly linked account in your <a href="/guides/accounts-section">Accounts</a> page.</p>
</div>
