Skip to content

Commit 44b7966

Browse files
fix: update backends for compute compatability
1 parent b444ac1 commit 44b7966

File tree

2 files changed

+43
-12
lines changed

2 files changed

+43
-12
lines changed

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
11
# Prerequisites
2-
3-
* Create a `terraform.tfvars` file, fill your `fastly_api_key`, `integration_domain`, `get_result_path`, `agent_script_download_path`
4-
* Create an empty Fastly Compute service and copy the id
5-
* Paste the id in `terraform.tfvars` file like this:
2+
* Create an empty compute service on Fastly and copy its ID.
3+
* Copy your Fastly API Key
4+
* Create your own terraform folder and create main.tf file
5+
* Fill the file like this:
66
```terraform
7-
service_id = "<your_service_id>"
7+
terraform {
8+
required_version = ">=1.5"
9+
}
10+
11+
module "compute" {
12+
source = "github.com/fingerprintjs/temp-fastly-compute-terraform"
13+
fastly_api_key = "<your fastly api key>"
14+
integration_domain = "<your domain to serve fingerprint integration>"
15+
service_id = "<your empty fastly compute service id>"
16+
agent_script_download_path = "<random path like this: qwe123>"
17+
get_result_path = "<random path like this: asd987>"
18+
}
819
```
20+
* Run `terraform init`
921

1022
# Deploy
1123

12-
After filling `terraform.tfvars` file, run these in order:
24+
Run these commands in order
1325
```shell
14-
terraform init
15-
terraform apply -target=module.compute_asset
16-
terraform import fastly_service_compute.fingerprint_integration "<your_service_id>"
26+
terraform apply -target=module.compute.module.compute_asset
27+
terraform import module.compute.fastly_service_compute.fingerprint_integration "<your empty fastly compute service id>"
1728
terraform apply
1829
```
1930

2031
# Custom Package
2132

2233
If you want to use your own asset instead of downloading latest follow these steps:
2334

24-
Place your custom asset in `<project_root>/assets/custom-asset.tar.gz` and then edit your `terraform.tfvars` file, and add these 2 variables:
35+
Place your custom asset in `<your_module_root>/assets/custom-asset.tar.gz` and then edit your `main.tf` file, and add these 2 variables inside "compute" module block:
2536
```terraform
2637
download_asset = false
2738
compute_asset_name = "custom-asset.tar.gz"
@@ -30,7 +41,7 @@ compute_asset_name = "custom-asset.tar.gz"
3041
Run these commands:
3142
```shell
3243
terraform init
33-
terraform import fastly_service_compute.fingerprint_integration "<your_service_id>"
44+
terraform import module.compute.fastly_service_compute.fingerprint_integration "<your empty fastly compute service id>"
3445
terraform apply
3546
```
3647

main.tf

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
required_providers {
44
fastly = {
55
source = "fastly/fastly"
6-
version = ">= 7.0.0"
6+
version = ">= 7.1.0"
77
}
88
}
99
}
@@ -71,24 +71,44 @@ resource "fastly_service_compute" "fingerprint_integration" {
7171
address = var.fpjs_backend_url
7272
name = var.fpjs_backend_url
7373
override_host = var.fpjs_backend_url
74+
prefer_ipv6 = false
75+
use_ssl = true
76+
ssl_cert_hostname = var.fpjs_backend_url
77+
ssl_sni_hostname = var.fpjs_backend_url
78+
port = 443
7479
}
7580

7681
backend {
7782
address = "eu.${var.fpjs_backend_url}"
7883
name = "eu.${var.fpjs_backend_url}"
7984
override_host = "eu.${var.fpjs_backend_url}"
85+
prefer_ipv6 = false
86+
use_ssl = true
87+
ssl_cert_hostname = "eu.${var.fpjs_backend_url}"
88+
ssl_sni_hostname = "eu.${var.fpjs_backend_url}"
89+
port = 443
8090
}
8191

8292
backend {
8393
address = "ap.${var.fpjs_backend_url}"
8494
name = "ap.${var.fpjs_backend_url}"
8595
override_host = "ap.${var.fpjs_backend_url}"
96+
prefer_ipv6 = false
97+
use_ssl = true
98+
ssl_cert_hostname = "ap.${var.fpjs_backend_url}"
99+
ssl_sni_hostname = "ap.${var.fpjs_backend_url}"
100+
port = 443
86101
}
87102

88103
backend {
89104
address = var.fpjs_cdn_url
90105
name = var.fpjs_cdn_url
91106
override_host = var.fpjs_cdn_url
107+
prefer_ipv6 = false
108+
use_ssl = true
109+
ssl_cert_hostname = var.fpjs_cdn_url
110+
ssl_sni_hostname = var.fpjs_cdn_url
111+
port = 443
92112
}
93113

94114
resource_link {

0 commit comments

Comments
 (0)