> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/management-and-administration/integrations/terraform.md).

# Terraform provider

Use the official [Harness Terraform provider](https://registry.terraform.io/providers/harness/harness/latest/docs) to manage Harness resources as code. The provider supports creating and managing environments, traffic types, segments, feature flags, flag sets, and API keys.

### Resources <a href="#resources" id="resources"></a>

The following Harness FME resources are available in the Harness Terraform provider.

#### Feature flags <a href="#feature-flags" id="feature-flags"></a>

| Resource                                                                                                                                             | Description                                                                            |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [harness\_fme\_feature\_flag](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_feature_flag)                        | Create and manage a feature flag.                                                      |
| [harness\_fme\_feature\_flag\_definition](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_feature_flag_definition) | Create and manage a feature flag definition, including treatments and targeting rules. |
| [harness\_fme\_flag\_set](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_flag_set)                                | Create and manage a flag set for grouping related feature flags.                       |

#### Environments <a href="#environments" id="environments"></a>

| Resource                                                                                                                   | Description                                        |
| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
| [harness\_fme\_environment](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_environment) | Create and manage an environment within a project. |

#### Segments <a href="#segments" id="segments"></a>

| Resource                                                                                                                                                                                     | Description                                                                   |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| [harness\_fme\_segment](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_segment)                                                                           | Create and manage a standard segment.                                         |
| [harness\_fme\_segment\_environment\_association](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_segment_environment_association)                         | Associate a standard segment with an environment.                             |
| [harness\_fme\_environment\_segment\_keys](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_environment_segment_keys)                                       | Manage the list of keys within a segment for a specific environment.          |
| [harness\_fme\_rule\_based\_segment](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_rule_based_segment)                                                   | Create and manage a rule-based segment using attribute-based targeting rules. |
| [harness\_fme\_rule\_based\_segment\_environment\_association](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_rule_based_segment_environment_association) | Associate a rule-based segment with an environment.                           |
| [harness\_fme\_large\_segment](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_large_segment)                                                              | Create and manage a large segment optimized for high-volume key lists.        |
| [harness\_fme\_large\_segment\_environment\_association](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_large_segment_environment_association)            | Associate a large segment with an environment.                                |

#### Traffic types <a href="#traffic-types" id="traffic-types"></a>

| Resource                                                                                                                                           | Description                                                       |
| -------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [harness\_fme\_traffic\_type](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_traffic_type)                      | Create and manage a traffic type within a project.                |
| [harness\_fme\_traffic\_type\_attribute](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_traffic_type_attribute) | Manage custom attributes and suggested values for a traffic type. |

#### API keys <a href="#api-keys" id="api-keys"></a>

| Resource                                                                                                            | Description                                                             |
| ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [harness\_fme\_api\_key](https://registry.terraform.io/providers/harness/harness/latest/docs/resources/fme_api_key) | Create and manage API keys for authenticating with the Harness FME API. |

### Data sources <a href="#data-sources" id="data-sources"></a>

| Data source                                                                                                               | Description                                                                                              |
| ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| [harness\_fme\_workspace](https://registry.terraform.io/providers/harness/harness/latest/docs/data-sources/fme_workspace) | Look up a Harness FME project by the workspace name, or by Harness organization and project identifiers. |

#### Example usage <a href="#example-usage" id="example-usage"></a>

```terraform
# Look up by Harness organization and project identifiers <a href="#look-up-by-harness-organization-and-project-identifiers" id="look-up-by-harness-organization-and-project-identifiers"></a>
data "harness_fme_workspace" "by_project" {
  org_id     = "organization_id"
  project_id = "project_id"
}

# Look up by exact workspace name <a href="#look-up-by-exact-workspace-name" id="look-up-by-exact-workspace-name"></a>
data "harness_fme_workspace" "by_name" {
  name = "my-workspace-name"
}
```

### Use the Harness Terraform provider <a href="#use-the-harness-terraform-provider" id="use-the-harness-terraform-provider"></a>

Go to the [Harness provider on the Terraform Registry](https://registry.terraform.io/providers/harness/harness/latest/docs) to review full provider documentation, configuration options, and examples.
