Skip to content

Commit d4a2283

Browse files
feat: remove fastly secret store item
1 parent 4690ed3 commit d4a2283

File tree

5 files changed

+5
-82
lines changed

5 files changed

+5
-82
lines changed

.terraform.lock.hcl

Lines changed: 0 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Prerequisites
22

3-
* Create a `terraform.tfvars` file, fill your `fastly_api_key`, `integration_domain`, `main_host`, `get_result_path`, `agent_script_download_path`, `proxy_secret`
3+
* Create a `terraform.tfvars` file, fill your `fastly_api_key`, `integration_domain`, `main_host`, `get_result_path`, `agent_script_download_path`
44
* Create an empty Fastly Compute service and copy the id
55
* Paste the id in `terraform.tfvars` file like this:
66
```terraform
@@ -34,6 +34,9 @@ terraform import fastly_service_compute.fingerprint_integration "<your_service_i
3434
terraform apply
3535
```
3636

37+
> After you deployed your service via terraform, you need to add Secret Store item with key PROXY_SECRET
38+
> to Secret Store created via Terraform and fill your value. This approach is suggested by Fastly. For details please see [this link](https://registry.terraform.io/providers/fastly/fastly/latest/docs/resources/secretstore) and check Note section.
39+
3740
# Destroy
3841

3942
To destroy, run this:
@@ -45,8 +48,4 @@ terraform destroy
4548

4649
* In our implementation for Fastly Compute, we support multiple proxy integrations in one account, in order to do this, we bind store names with compute service id.
4750
To apply this on terraform, we run in to cyclical dependency problem. In order to fix this, we rely on already created empty service and its ID.
48-
* Fastly Terraform Provider officially doesn't support storing secret items via terraform.
49-
So we are using MasterCard's RestApi provider to put our `PROXY_SECRET`.
5051
* If you use your own custom asset, then you need to maintain your asset's version on your own!
51-
* If you use plugin system for Fastly Compute Proxy Integration, this module doesn't support KV Store yet! It'll be implemented in the future
52-
* This module doesn't create TLS certificate for your service yet! It'll be implemented in the future

main.tf

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,13 @@ terraform {
44
source = "fastly/fastly"
55
version = ">= 7.0.0"
66
}
7-
restapi = {
8-
source = "Mastercard/restapi"
9-
version = "2.0.1"
10-
}
117
}
128
}
139

1410
provider "fastly" {
1511
api_key = var.fastly_api_key
1612
}
1713

18-
provider "restapi" {
19-
uri = "https://api.fastly.com"
20-
headers = {
21-
"Fastly-Key" = var.fastly_api_key
22-
}
23-
id_attribute = "id"
24-
write_returns_object = true
25-
copy_keys = ["id"]
26-
}
27-
2814
module "compute_asset" {
2915
count = var.download_asset ? 1 : 0
3016
source = "./modules/download_asset"
@@ -68,16 +54,6 @@ resource "fastly_secretstore" "integration_secret_store" {
6854
name = local.secret_store_name
6955
}
7056

71-
resource "restapi_object" "add_proxy_secret" {
72-
data = jsonencode({ "name" = "PROXY_SECRET", "secret" = base64encode(var.proxy_secret) })
73-
path = "/resources/stores/secret/${fastly_secretstore.integration_secret_store.id}/secrets"
74-
depends_on = [fastly_secretstore.integration_secret_store]
75-
object_id = "PROXY_SECRET"
76-
lifecycle {
77-
ignore_changes = all
78-
}
79-
}
80-
8157
resource "fastly_service_compute" "fingerprint_integration" {
8258
name = var.integration_name
8359

@@ -142,7 +118,7 @@ resource "fastly_service_compute" "fingerprint_integration" {
142118

143119
depends_on = [
144120
fastly_configstore.integration_config_store, fastly_configstore_entries.integration_config_store_entries,
145-
fastly_secretstore.integration_secret_store, restapi_object.add_proxy_secret
121+
fastly_secretstore.integration_secret_store
146122
]
147123
}
148124

terraform.tfvars.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ main_host = "metrics-origin.mydomain.com" # Set here to something like metrics-o
44
integration_path = "" # Main path to serve this proxy integration from. Please use random string minimum 6 characters long, no special characters like `w2kz84h`
55
agent_script_download_path = "" # Fingerprint Javascript Agent download path. Please use random string minimum 6 characters long, no special characters like `w2kz84h`
66
get_result_path = "" # Fingerprint Identification endpoint path. Please use random string minimum 6 characters long, no special characters like `w2kz84h`
7-
proxy_secret = "" # Obtain this proxy secret from fingerprint.com dashboard
87
kv_store_enabled = true # Enable KV Store service deployment
98
kv_store_save_plugin_enabled = "true" # Enable Fingerprint's builtin KV Store Open Client Response plugin

variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ variable "get_result_path" {
3535
default = "result"
3636
}
3737

38-
variable "proxy_secret" {
39-
type = string
40-
sensitive = true
41-
}
42-
4338
variable "repository_organization_name" {
4439
type = string
4540
default = "fingerprintjs"

0 commit comments

Comments
 (0)