---
layout: "fastly"
page_title: "Fastly: compute_acl_entries"
sidebar_current: "docs-fastly-resource-compute-acl-entries"
description: |-
  Manage CIDR entries within a Fastly Compute ACL.
---

# fastly_compute_acl_entries

The `fastly_compute_acl_entries` resource allows you to manage CIDR-based allow/block rules (ACL entries) inside a Fastly Compute ACL.

By default, Terraform does not continue to manage the entries after the initial `terraform apply`. This allows you to make changes to ACL entries outside of Terraform using the [Fastly API](https://developer.fastly.com/reference/api/) or [Fastly CLI](https://developer.fastly.com/learning/tools/cli/)) without Terraform resetting them.

To have Terraform continue managing the entries after creation (e.g., deleting any entries not defined in the config), set `manage_entries = true`.

~> **Note:** Use `manage_entries = true` cautiously. Terraform will overwrite external changes and delete any unmanaged entries.

## Example Usage

Basic usage (with seeded values, unmanaged after initial apply):

```terraform
# IMPORTANT: Deleting a Compute ACL requires first deleting its resource_link.
# This requires a two-step `terraform apply` as we can't guarantee deletion order.
resource "fastly_compute_acl" "example" {
  name = "my_compute_acl"
}

resource "fastly_compute_acl_entries" "example" {
  compute_acl_id = fastly_compute_acl.example.id
  entries = {
    "192.0.2.0/24"    = "ALLOW"
    "198.51.100.0/24" = "BLOCK"
  }
}

resource "fastly_service_compute" "example" {
  name = "my_compute_service"

  domain {
    name = "demo.example.com"
  }

  package {
    filename         = "package.tar.gz"
    source_code_hash = data.fastly_package_hash.example.hash
  }

  resource_link {
    name        = "my_acl_link"
    resource_id = fastly_compute_acl.example.id
  }

  force_destroy = true
}

data "fastly_package_hash" "example" {
  filename = "package.tar.gz"
}
```

Terraform-managed usage (where Terraform controls entries long-term):

```terraform
# IMPORTANT: Deleting a Compute ACL requires first deleting its resource_link.
# This requires a two-step `terraform apply` as we can't guarantee deletion order.
resource "fastly_compute_acl" "example" {
  name = "my_compute_acl"
}

resource "fastly_compute_acl_entries" "example" {
  compute_acl_id = fastly_compute_acl.example.id
  entries = {
    "203.0.113.0/24"  = "BLOCK"
    "198.51.100.0/24" = "ALLOW"
  }
  manage_entries = true
}

resource "fastly_service_compute" "example" {
  name = "my_compute_service"

  domain {
    name = "demo.example.com"
  }

  package {
    filename         = "package.tar.gz"
    source_code_hash = data.fastly_package_hash.example.hash
  }

  resource_link {
    name        = "my_acl_link"
    resource_id = fastly_compute_acl.example.id
  }

  force_destroy = true
}

data "fastly_package_hash" "example" {
  filename = "package.tar.gz"
}
```

## Import

Fastly Compute ACL entries can be imported using the format `<compute_acl_id>/entries`, e.g.

```sh
$ terraform import fastly_compute_acl_entries.example <compute_acl_id>/entries
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `compute_acl_id` (String) Manages entries for a Fastly Compute Access Control List (ACL). To import, use the format <compute_acl_id>/entries.
- `entries` (Map of String) A map representing the entries in the Compute ACL, where the keys are the prefixes and the values are the actions (ALLOW or BLOCK).

### Optional

- `manage_entries` (Boolean) Manage the ACL entries in Terraform (default: false). If true, Terraform will ensure that the ACL's entries match the entries in the Terraform configuration.

### Read-Only

- `id` (String) The ID of this resource.
