-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kv_store): support KV Store (#691)
* refactor: rename function used across both service types to be generic * feat(kv_store): add kv_store block * docs(kv_store): generate documentation * docs(fastly_service_compute): document kv store feature restriction * refactor(kv_store): replace block with separate resource * docs(kv_store): add descriptions for resource_link block * docs(fastly_kvstore): add examples * test(fastly_kvstore): add tests with resource_links block validation * docs: update * test(fastly_kvstore): validate force_destroy * fix(kvstore): add ForceNew to name attribute
- Loading branch information
1 parent
774b730
commit 3488948
Showing
63 changed files
with
880 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
layout: "fastly" | ||
page_title: "Fastly: kvstore" | ||
sidebar_current: "docs-fastly-resource-kvstore" | ||
description: |- | ||
Provides a persistent, globally consistent key-value store accessible to Compute@Edge services during request processing. | ||
--- | ||
|
||
# fastly_kvstore | ||
|
||
Provides a persistent, globally consistent key-value store accessible to Compute@Edge services during request processing. | ||
|
||
-> **Note** The `kv_store` feature does not support seeding the store with data. This is because the size of objects that can be stored is very large and Terraform is designed for containing [configuration, not data](https://developer.fastly.com/learning/integrations/orchestration/terraform/#configuration-not-data). You should use either the [Fastly CLI](https://developer.fastly.com/learning/tools/cli/), [Fastly API](https://developer.fastly.com/reference/api/) or one of the available [Fastly API Clients](https://developer.fastly.com/reference/api/#clients) to populate your KV Store. | ||
|
||
## Example Usage | ||
|
||
Basic usage: | ||
|
||
```terraform | ||
# IMPORTANT: Deleting a KV 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_kvstore" "example" { | ||
name = "my_kv_store" | ||
} | ||
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_kvstore.example.id | ||
} | ||
force_destroy = true | ||
} | ||
data "fastly_package_hash" "example" { | ||
filename = "package.tar.gz" | ||
} | ||
``` | ||
|
||
## Import | ||
|
||
Fastly KV Stores can be imported using their Store ID, e.g. | ||
|
||
```sh | ||
$ terraform import fastly_kvstore.example xxxxxxxxxxxxxxxxxxxx | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `name` (String) A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. | ||
|
||
### Optional | ||
|
||
- `force_destroy` (Boolean) Allow the KV store to be deleted, even if it contains entries. Defaults to false. | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$ terraform import fastly_kvstore.example xxxxxxxxxxxxxxxxxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# IMPORTANT: Deleting a KV 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_kvstore" "example" { | ||
name = "my_kv_store" | ||
} | ||
|
||
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_kvstore.example.id | ||
} | ||
|
||
force_destroy = true | ||
} | ||
|
||
data "fastly_package_hash" "example" { | ||
filename = "package.tar.gz" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.