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

# Registry ACLs

> Manage MCP server, MCP tool, and skill access with Terraform.

Forge provides separate ACL resources for MCP servers and skills. Both resolve
readable registry selectors and directory subjects during the connected plan,
then retain the readable configuration in Terraform state.

## MCP ACL

`forge_mcp_acl` compiles to a Terraform-managed Content policy evaluated at
`pre_tool`. It matches one MCP server and, optionally, a subset of that
server's tools.

| Attribute             | Type                      | Behavior                                                                                    |
| --------------------- | ------------------------- | ------------------------------------------------------------------------------------------- |
| `id`                  | Required string           | Stable ACL and policy ID. Changing it replaces the resource.                                |
| `name`                | Required string           | Mutable policy name.                                                                        |
| `enabled`             | Optional boolean          | Defaults to `true`.                                                                         |
| `server`              | Required string           | Exact MCP server name or slug resolved by Forge.                                            |
| `tools`               | Optional set(string)      | Between 1 and 256 exact tool names when supplied; omission covers every tool on the server. |
| `users`               | Optional set(string)      | Exact user emails.                                                                          |
| `groups`              | Optional set(string)      | Exact group names.                                                                          |
| `user_directory_ids`  | Optional map(string)      | Directory qualifier for duplicate exact user matches. Keys must also occur in `users`.      |
| `group_directory_ids` | Optional map(string)      | Directory qualifier for duplicate exact group matches. Keys must also occur in `groups`.    |
| `effect`              | Required enum             | `allow` or `block`.                                                                         |
| `current_revision`    | Computed integer          | Immutable server revision used for optimistic concurrency.                                  |
| `definition_sha256`   | Computed string           | Digest of the canonical compiled policy.                                                    |
| `validation_token`    | Computed sensitive string | Short-lived binding between the connected plan and apply.                                   |

At least one user or group is required. An empty subject set is rejected rather
than interpreted as everyone.

```hcl theme={"system"}
resource "forge_mcp_acl" "github_write" {
  id      = "github-write"
  name    = "GitHub write access"
  enabled = true
  server  = "github"

  tools = [
    "create_pull_request",
    "merge_pull_request",
  ]

  groups = ["Engineering"]
  effect = "allow"
}
```

Qualify an ambiguous directory group:

```hcl theme={"system"}
resource "forge_mcp_acl" "finance_drive" {
  id     = "finance-drive"
  name   = "Finance Drive access"
  server = "google-drive"
  groups = ["Finance"]

  group_directory_ids = {
    Finance = "dir_okta_primary"
  }

  effect = "allow"
}
```

This resource does not edit an MCP Registry-owned policy projection. Registry
policy and Terraform ACLs can both match the same request; Forge evaluates the
complete applicable Content-policy set.

## Skill ACL

`forge_skill_acl` controls whether exact users or groups can use one registered
skill.

| Attribute             | Type                      | Behavior                                                                  |
| --------------------- | ------------------------- | ------------------------------------------------------------------------- |
| `id`                  | Required string           | Stable ACL ID. Changing it replaces the resource.                         |
| `skill`               | Required string           | Exact skill name or slug resolved by Forge.                               |
| `enabled`             | Optional boolean          | Defaults to `true`.                                                       |
| `users`               | Optional set(string)      | Exact user emails.                                                        |
| `groups`              | Optional set(string)      | Exact group names.                                                        |
| `everyone`            | Optional boolean          | Set to `true` for every subject; cannot be combined with users or groups. |
| `user_directory_ids`  | Optional map(string)      | Directory qualifier for duplicate user matches.                           |
| `group_directory_ids` | Optional map(string)      | Directory qualifier for duplicate group matches.                          |
| `effect`              | Required enum             | `allow` or `block`.                                                       |
| `current_revision`    | Computed integer          | Current immutable revision.                                               |
| `definition_sha256`   | Computed string           | Digest of the canonical definition.                                       |
| `validation_token`    | Computed sensitive string | Connected-plan binding managed by the provider.                           |

Set exactly one subject mode: one or more users/groups, or `everyone = true`.

```hcl theme={"system"}
resource "forge_skill_acl" "production_deploy" {
  id      = "production-deploy-engineering"
  skill   = "deploy-production"
  enabled = true
  groups  = ["Engineering"]
  effect  = "allow"
}

resource "forge_skill_acl" "contractor_block" {
  id     = "production-deploy-contractors"
  skill  = "deploy-production"
  groups = ["Contractors"]
  effect = "block"
}

resource "forge_skill_acl" "block_unapproved_skill" {
  id       = "block-unapproved-skill"
  skill    = "unapproved-export"
  everyone = true
  effect   = "block"
}
```

## Planning

A connected plan resolves:

* The MCP server or skill to exactly one registry object.
* Every user and group to exactly one directory identity, using directory
  qualifiers when provided.
* MCP tool names against the selected server.
* Current policy revision and Terraform authority.
* The complete compiled policy definition.

Missing or ambiguous references fail the plan. The provider does not silently
drop a selector or select the first match.

## Import

Import by the stable ACL ID:

```bash theme={"system"}
terraform import forge_mcp_acl.github_write github-write
terraform import forge_skill_acl.production_deploy production-deploy-engineering
```

Import does not claim an existing Forge-managed policy. Adopt the policy with
`forge_policy_authority` first when it is not already owned by the same
Terraform manager.

## Destroy

Destroy uses the last observed revision and fails on concurrent modification.
Both resources are removed through their policy-family authority and revision
checks; the provider does not issue an unguarded registry deletion. Use
`prevent_destroy` when removal requires separate security review:

```hcl theme={"system"}
lifecycle {
  prevent_destroy = true
}
```
