---
layout: "fastly"
page_title: "Fastly: configstore_entries"
sidebar_current: "docs-fastly-resource-configstore-entries"
description: |-
  A key-value pair within a config store.
---

# fastly_configstore_entries

The Config Store (`fastly_configstore`) can be seeded with initial key-value pairs using the `fastly_configstore_entries` resource.

After the first `terraform apply` the default behaviour is to ignore any further configuration changes to those key-value pairs. Terraform will expect modifications to happen outside of Terraform (e.g. new key-value pairs to be managed using the [Fastly API](https://developer.fastly.com/reference/api/) or [Fastly CLI](https://developer.fastly.com/learning/tools/cli/)).

To change the default behaviour (so Terraform continues to manage the key-value pairs within the configuration) set `manage_entries = true`.

~> **Note:** Terraform should not be used to store large amounts of data, so it's recommended you leave the default behaviour in place and only seed the store with a small amount of key-value pairs. For more information see ["Configuration not data"](https://developer.fastly.com/learning/integrations/orchestration/terraform/#configuration-not-data).

## Example Usage

Basic usage (with seeded values):

```terraform
# IMPORTANT: Deleting a Config Store requires first deleting its resource_link.
# This requires a two-step `terraform apply` as we can't guarantee deletion order.
# e.g. resource_link deletion within fastly_service_compute might not finish first.
resource "fastly_configstore" "example" {
  name = "%s"
}

resource "fastly_configstore_entries" "example" {
  store_id = fastly_configstore.example.id
  entries = {
    key1 : "value1"
    key2 : "value2"
  }
}

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_resource_link"
    resource_id = fastly_configstore.example.id
  }

  force_destroy = true
}

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

To have Terraform manage the initially seeded key-value pairs defined in your configuration, then you must set `manage_entries = true` (this will cause any key-value pairs added outside of Terraform to be deleted):

```terraform
# IMPORTANT: Deleting a Config Store requires first deleting its resource_link.
# This requires a two-step `terraform apply` as we can't guarantee deletion order.
# e.g. resource_link deletion within fastly_service_compute might not finish first.
resource "fastly_configstore" "example" {
  name = "%s"
}

resource "fastly_configstore_entries" "example" {
  store_id = fastly_configstore.example.id
  entries = {
    key1 : "value1"
    key2 : "value2"
  }
  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_resource_link"
    resource_id = fastly_configstore.example.id
  }

  force_destroy = true
}

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

## Import

Fastly Config Stores entries can be imported using the corresponding Config Store ID with the `/entries` suffix, e.g.

```sh
$ terraform import fastly_configstore_entries.example xxxxxxxxxxxxxxxxxxxx/entries
```

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

### Required

- `entries` (Map of String) A map representing an entry in the Config Store, (key/value)
- `store_id` (String) An alphanumeric string identifying the Config Store.

### Optional

- `manage_entries` (Boolean) Have Terraform manage the entries (default: false). If set to `true` Terraform will remove any entries that were added externally from the config seeded values.

### Read-Only

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