|
1 |
| -# Prerequisites |
| 1 | +<p align="center"> |
| 2 | +<a href="https://fingerprint.com"> |
| 3 | +<picture> |
| 4 | +<source media="(prefers-color-scheme: dark)" srcset="https://fingerprintjs.github.io/home/resources/logo_light.svg" /> |
| 5 | +<source media="(prefers-color-scheme: light)" srcset="https://fingerprintjs.github.io/home/resources/logo_dark.svg" /> |
| 6 | +<img src="https://fingerprintjs.github.io/home/resources/logo_dark.svg" alt="Fingerprint logo" width="312px" /> |
| 7 | +</picture> |
| 8 | +</a> |
| 9 | +</p> |
| 10 | + |
| 11 | +<p align="center"> |
| 12 | +<a href="https://registry.terraform.io/modules/fingerprintjs/vcl-fingerprint-proxy-integration/fastly/latest"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fregistry.terraform.io%2Fv2%2Fmodules%2Ffingerprintjs%2Fvcl-fingerprint-proxy-integration%2Ffastly%3Finclude%3Dlatest-version&query=%24.included%5B0%5D.attributes.version&prefix=v&label=Terraform" alt="Current version"></a> |
| 13 | +<a href="https://github.com/fingerprintjs/terraform-fastly-vcl-fingerprint-proxy-integration"><img src="https://img.shields.io/github/v/release/fingerprintjs/terraform-fastly-vcl-fingerprint-proxy-integration" alt="Current version"></a> |
| 14 | +<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/:license-mit-blue.svg" alt="MIT license"></a> |
| 15 | +<a href="https://discord.gg/39EpE2neBg"><img src="https://img.shields.io/discord/852099967190433792?style=logo&label=Discord&logo=Discord&logoColor=white" alt="Discord server"></a> |
| 16 | +</p> |
| 17 | + |
| 18 | +# Fingerprint Fastly VCL Integration (Terraform module) |
| 19 | + |
| 20 | +[Fingerprint](https://fingerprint.com/) is a device intelligence platform offering industry-leading accuracy. |
| 21 | + |
| 22 | +Fingerprint Fastly VCL Integration is responsible for |
| 23 | + |
| 24 | +- Proxying download requests of the latest Fingerprint JS Agent between your site and Fingerprint CDN. |
| 25 | +- Proxying identification requests and responses between your site and Fingerprint's APIs. |
| 26 | + |
| 27 | +This [improves](https://dev.fingerprint.com/docs/fastly-vcl-proxy-integration#the-benefits-of-using-the-fastly-vcl-proxy-integration) both accuracy and reliability of visitor identification and bot detection on your site. |
| 28 | + |
| 29 | +You can install the Fastly VCL proxy integration [manually](https://dev.fingerprint.com/docs/deploy-fastly-vcl-manually) or as [a Terraform module](https://registry.terraform.io/modules/fingerprintjs/vcl-fingerprint-proxy-integration/fastly/latest) included in this repository. For more details, see the [full documentation](https://dev.fingerprint.com/docs/fastly-vcl-proxy-integration). |
| 30 | + |
| 31 | + |
| 32 | +## Requirements |
| 33 | + |
| 34 | +- [Fastly](https://www.fastly.com/signup) Account |
| 35 | +- [Terraform CLI](https://developer.hashicorp.com/terraform/install). |
| 36 | +- [Fastly API Token](https://manage.fastly.com/account/tokens) |
| 37 | + |
| 38 | +> [!IMPORTANT] |
| 39 | +> The Fastly VCL Proxy Integration is exclusively supported for customers on the Enterprise Plan. Other customers are encouraged to use [Custom subdomain setup](https://dev.fingerprint.com/docs/custom-subdomain-setup) or [Cloudflare Proxy Integration](https://dev.fingerprint.com/docs/cloudflare-integration). |
| 40 | +
|
| 41 | +> [!WARNING] |
| 42 | +> The underlying data contract in the identification logic can change to keep up with browser updates. Using the Fastly VCL Proxy Integration might require occasional manual updates on your side. Ignoring these updates will lead to lower accuracy or service disruption. |
| 43 | +
|
| 44 | +## 1. Install the Terraform module |
| 45 | + |
| 46 | +1. Add the module to your Terraform file (for example, `main.tf`). |
| 47 | +2. Configure it with your Fastly API token, Fingerprint proxy secret, integration domain, and other required values. |
2 | 48 |
|
3 |
| -* Copy your Fastly API token |
4 |
| -* Create your own terraform folder and create main.tf file |
5 |
| -* Fill the file like this: |
6 | 49 | ```terraform
|
7 | 50 | terraform {
|
8 | 51 | required_version = ">=1.5"
|
9 | 52 | }
|
10 | 53 |
|
11 | 54 | module "fingerprint_fastly_vcl_integration" {
|
12 | 55 | source = "github.com/fingerprintjs/temp-fastly-vcl-terraform"
|
13 |
| - fastly_api_token = "<your fastly api token>" |
14 |
| - integration_domain = "<your domain to serve fingerprint integration>" |
15 |
| - agent_script_download_path = "<random path like this: qwe123>" |
16 |
| - get_result_path = "<random path like this: asd987>" |
17 |
| - integration_path = "<random path like this: xyz456>" |
18 |
| - main_host = "<your origin domain to serve your website>" |
19 |
| - proxy_secret = "<your proxy secret>" |
| 56 | + fastly_api_token = "FASTLY_API_TOKEN" |
| 57 | + proxy_secret = "FINGERPRINT_PROXY_SECRET" |
| 58 | + integration_path = "INTEGRATION_PATH" |
| 59 | + agent_script_download_path = "AGENT_SCRIPT_DOWNLOAD_PATH" |
| 60 | + get_result_path = "GET_RESULT_PATH" |
| 61 | + integration_domain = "metrics.yourwebsite.com" |
| 62 | + main_host = "yourwebsite.com" |
20 | 63 | }
|
21 | 64 | ```
|
22 |
| -* Run `terraform init` |
23 | 65 |
|
24 |
| -# Deploy |
| 66 | +You can see the full list of the Terraform module's variables below: |
25 | 67 |
|
26 |
| -Run these commands in order |
27 |
| -```shell |
28 |
| -terraform init |
29 |
| -terraform apply -target=module.fingerprint_fastly_vcl_integration.module.vcl_asset |
30 |
| -terraform apply |
31 |
| -``` |
| 68 | +| Variable | Description | Required | Example | |
| 69 | +| ---------------------------- | --------------------------------------------------------- | -------- | ---------------------------------------------- | |
| 70 | +| `fastly_api_token` | Your Fastly API token | Required | `"ABC123...xyz"` | |
| 71 | +| `proxy_secret` | Your Fingerprint proxy secret | Required | `"9h7jk2s1"` | |
| 72 | +| `integration_path` | Path prefix for proxy requests | Required | `"kyfy7t0a"` | |
| 73 | +| `agent_script_download_path` | Path for serving the JavaScript agent | Required | `"cc7bu2o8"` | |
| 74 | +| `get_result_path` | Path for identification requests | Required | `"sy5k3279"` | |
| 75 | +| `integration_domain` | Domain used for the proxy integration | Required | `"metrics.yourwebsite.com"` | |
| 76 | +| `main_host` | Your origin server domain | Required | `"yourwebsite.com"` | |
| 77 | +| `dictionary_name` | Name of the Fastly Dictionary for config values | Optional | `"fingerprint_config"` | |
| 78 | +| `integration_name` | Name of the Fastly CDN service | Optional | `"fingerprint-fastly-vcl-proxy-integration"` | |
| 79 | +| `download_asset` | Whether to auto-download the latest VCL release | Optional | `true` | |
| 80 | +| `vcl_asset_name` | Custom VCL asset file if not downloading the official one | Optional | `"fingerprint-pro-fastly-vcl-integration.vcl"` | |
| 81 | +| `asset_version` | GitHub release version used for the VCL asset | Optional | `"latest"` | |
32 | 82 |
|
33 |
| -# Custom VCL |
| 83 | +## 2. Deploy your Terraform changes |
34 | 84 |
|
35 |
| -If you want to use your own asset instead of downloading latest follow these steps: |
| 85 | +1. Initialize the Terraform module: |
| 86 | + |
| 87 | + ```shell |
| 88 | + terraform init |
| 89 | + ``` |
36 | 90 |
|
37 |
| -Place your custom asset in `<your_module_root>/assets/custom-asset.vcl` and then edit your `main.tf` file, and add these 2 variables inside "vcl" module block: |
38 |
| -```terraform |
39 |
| -download_asset = false |
40 |
| -vcl_asset_name = "custom-asset.vcl" |
41 |
| -``` |
| 91 | +2. Apply the VCL asset: |
42 | 92 |
|
43 |
| -Run these commands: |
44 |
| -```shell |
45 |
| -terraform init |
46 |
| -terraform apply |
47 |
| -``` |
| 93 | + ```shell |
| 94 | + terraform apply -target=module.fingerprint_fastly_vcl_integration.module.vcl_asset |
| 95 | + ``` |
48 | 96 |
|
49 |
| -# Destroy |
| 97 | +3. Apply the changes to your Fastly service: |
| 98 | + |
| 99 | + ```shell |
| 100 | + terraform apply |
| 101 | + ``` |
| 102 | + |
| 103 | +## Using a custom VCL asset (optional) |
| 104 | + |
| 105 | +You can use your own VCL asset instead of downloading the official one: |
| 106 | + |
| 107 | +1. Place your custom asset in `<your_module_root>/assets/custom-asset.vcl` |
| 108 | +2. In your `main.tf` file, add these 2 variables to the module configuration: |
| 109 | + |
| 110 | + ```diff |
| 111 | + module "fingerprint_fastly_vcl_integration" { |
| 112 | + # ... |
| 113 | + + download_asset = false |
| 114 | + + vcl_asset_name = "custom-asset.vcl" |
| 115 | + } |
| 116 | + ``` |
| 117 | + |
| 118 | +3. Run `terraform init`. |
| 119 | +4. Run `terraform apply`. |
| 120 | + |
| 121 | +## Examples |
| 122 | + |
| 123 | +This repository also includes an example Terraform project. Use this example only as a reference, and make sure to follow best practices when provisioning Fastly services: |
| 124 | + |
| 125 | +- [Minimal example](./examples/minimal/) |
| 126 | + |
| 127 | +## How to update |
| 128 | + |
| 129 | +The Terraform module does include any mechanism for automatic updates. To keep your integration up to date, please run `terraform apply` regularly. |
| 130 | + |
| 131 | +## More resources |
| 132 | + |
| 133 | +- [Documentation](https://dev.fingerprint.com/docs/fastly-vcl-proxy-integration) |
| 134 | + |
| 135 | +## License |
| 136 | + |
| 137 | +This project is licensed under the MIT license. See the [LICENSE](/LICENSE) file for more info. |
50 | 138 |
|
51 |
| -To destroy, run this: |
52 |
| -```shell |
53 |
| -terraform destroy |
54 |
| -``` |
|
0 commit comments