# HCP Terraform

## Terraform Run Task Integration

Gomboc AI for Infrastructure as Code automatically fixes misconfigurations in your Terraform code. Gomboc translates cloud policies into production-ready IaC fixes delivered as pull requests, so you can merge confidently and keep pipelines moving without disruption.

## Integration Setup

Follow these steps to configure the Terraform Run Task integration:

### Step 1: Access Gomboc Portal

Navigate to **Settings > Integrations > HashiCorp** in the Gomboc Portal.

<div align="center"><figure><img src="https://3084082483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3GhAYjoqbnAMyhHhAr%2Fuploads%2Fgit-blob-ef1e68f17490b5ec3c46259f4191ca4cf6666f4e%2Frun-task-gomboc-integrations.jpeg?alt=media" alt="Gomboc Integrations page showing HashiCorp section"><figcaption></figcaption></figure></div>

### Step 2: Create Integration

Enter a name to identify this integration and click **Integrate** to generate credentials.

<div align="center"><figure><img src="https://3084082483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3GhAYjoqbnAMyhHhAr%2Fuploads%2Fgit-blob-3d21d7e59597854221871bc97bcda259696fe9d7%2Frun-task-gomboc-integration.png?alt=media" alt="Integration creation form"><figcaption></figcaption></figure></div>

### Step 3: Collect Credentials

Copy the **HMAC Key** and **Webhook URL** - you’ll need these to configure the Run Task in Terraform Cloud.

<div align="center"><figure><img src="https://3084082483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3GhAYjoqbnAMyhHhAr%2Fuploads%2Fgit-blob-3bebbd73a84bd4d31f733b559def5545043b7ca5%2Frun-task-gomboc-integration-collect.png?alt=media" alt="Integration credentials display"><figcaption></figcaption></figure></div>

### Step 4: Access HCP Organization

Now that your Gomboc-side integration is ready, let’s switch over to Terraform Cloud to finish setup. In a new tab, go to <https://app.terraform.io/> and select the organization where you want to enable this integration.

<div align="center"><figure><img src="https://3084082483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3GhAYjoqbnAMyhHhAr%2Fuploads%2Fgit-blob-5030bfdfba27c916691a183a7761ae0707feb75b%2Frun-task-hcp-org.jpeg?alt=media" alt="HCP organization selection"><figcaption></figcaption></figure></div>

### Step 5: Navigate to Run Tasks

Go to **Settings > Integrations > Run tasks** and click **"Create run task"**.

<div align="center"><figure><img src="https://3084082483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3GhAYjoqbnAMyhHhAr%2Fuploads%2Fgit-blob-71c4a41163d9af7b3e0053423082f8b3104b63ae%2Frun-task-hcp-create.jpeg?alt=media" alt="HCP Run Tasks page with create button"><figcaption></figcaption></figure></div>

### Step 6: Configure Run Task

Paste the Webhook URL and HMAC Key from Step 3 into the respective fields and add a display name.

<div align="center"><figure><img src="https://3084082483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3GhAYjoqbnAMyhHhAr%2Fuploads%2Fgit-blob-987d477ed13b400158e0dda33342ca0bbc6985b2%2Frun-task-create-enter-data.jpeg?alt=media" alt="Run task configuration form"><figcaption></figcaption></figure></div>

### Step 7: Set Scope and Create

Configure the scope for your Run Task and click **Create**.

<div align="center"><figure><img src="https://3084082483-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9X3GhAYjoqbnAMyhHhAr%2Fuploads%2Fgit-blob-e2e4307285ac8989c50a8e6eecfaaa7d5bab233c%2Frun-task-hcp-scope.png?alt=media" alt="Run task scope configuration"><figcaption></figcaption></figure></div>

## Configuration Options

### Scope Selection

When setting the scope for your Run Task, you can choose any scope that fits your workflow needs.

**Recommendation:** Select any option **except** "post-apply" to ensure Gomboc can remediate issues before changes are applied to your infrastructure.

### Enforcement Levels

You'll be prompted to select an enforcement level:

* **Advisory:** Shows warnings for detected misconfigurations but **does not block** the Terraform run from proceeding
* **Mandatory:** Shows errors for detected misconfigurations and **blocks** the Terraform run until issues are resolved

Choose the enforcement level that best matches your organization's policy for infrastructure changes.

### Deployment Options

You can configure Run Tasks at two levels:

#### Organization-Level Run Tasks

* Apply to all workspaces within the selected organization
* Ensures consistent policy enforcement across your infrastructure
* Recommended for most organizations

#### Workspace-Level Run Tasks

* Provide more granular control for specific teams or projects
* To configure: Skip the global setup in Step 7, then navigate to the desired workspace in HCP Terraform
* Go to **Settings > Run Tasks** and add the Gomboc Run Task you created

Choose the configuration approach that best fits your workflow and organizational requirements.

***

**Need help?** Leave feedback via our [GitHub discussions channel.](https://github.com/Gomboc-AI/gomboc-ai-feedback/discussions/6)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gomboc.ai/integrations/cloud-orchestration/hcp-terraform.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
