Skip to content

fingerprintjs/terraform-fastly-compute-fingerprint-proxy-integration

Repository files navigation

Fingerprint logo

Current version Current version MIT license Discord server

Fingerprint Fastly Compute Integration (Terraform module)

Fingerprint is a device intelligence platform offering industry-leading accuracy.

Fingerprint Fastly Compute Integration is responsible for

  • Proxying download requests of the latest Fingerprint JS Agent between your site and Fingerprint CDN.
  • Proxying identification requests and responses between your site and Fingerprint's APIs.

This improves both accuracy and reliability of visitor identification and bot detection on your site.

You can install the Fastly Compute proxy integration manually or as a Terraform module included in this repository. For more details, see the full documentation.

Requirements

Important

The Fastly Compute Proxy Integration is exclusively supported for customers on the Enterprise Plan. Other customers are encouraged to use Custom subdomain setup or Cloudflare Proxy Integration.

Warning

The underlying data contract in the identification logic can change to keep up with browser updates. Using the Fastly Compute Proxy Integration might require occasional manual updates on your side. Ignoring these updates will lead to lower accuracy or service disruption.

How to install

1. Create an empty Fastly Compute Service

Create and empty Fastly Compute service, for example, using the Fastly web interface. Note down the service ID.

2. Install the Terraform module

Add the module to your Terraform file (for example, main.tf) and configure it with your Fastly API token, Fingerprint proxy secret, integration domain, and other required values:

terraform {
  required_version = ">=1.5"
}

module "fingerprint_fastly_compute_integration" {
  source                     = "github.com/fingerprintjs/temp-fastly-compute-terraform"
  fastly_api_token           = "FASTLY_API_TOKEN"
  service_id                 = "EMPTY_FASTLY_COMPUTE_SERVICE_ID"
  agent_script_download_path = "AGENT_SCRIPT_DOWNLOAD_PATH"
  get_result_path            = "GET_RESULT_PATH"
  integration_domain         = "metrics.yourwebsite.com"
}

You can see the full list of the Terraform module's variables below:

Variable Description Required Example
fastly_api_token Your Fastly API token Required "ABC123...xyz"
service_id ID of your empty Fastly Compute service Required "SU1Z0isxPaozGVKXdv0eY"
agent_script_download_path Path to serve agent script from your domain Required "4fs80xgx"
get_result_path Path to serve identification and browser cache requests Required "vpyr9bev"
integration_domain Domain used for your proxy integration Required "metrics.yourdomain.com"
integration_name Name of Fastly service Optional "fingerprint-fastly-compute-proxy-integration"
download_asset Whether to auto-download latest release Optional true
compute_asset_name Custom filename if not downloading Optional "fingerprint-fastly-compute-proxy-integration.tar.gz"
asset_version GitHub release version of proxy integration Optional "latest"
kv_store_enabled Enable KV store integration Optional false
kv_store_save_plugin_enabled Enables plugin to save to KV store Optional "false"
fpjs_backend_url Domain for Ingress endpoint & browser cache endpoint Optional "api.fpjs.io"
fpjs_cdn_url Domain for Agent Script Optional "fpcdn.io"

2. Deploy your Terraform changes

  1. Initialize the Terraform module

    terraform init
  2. Apply the Compute Asset

    terraform apply -target=module.fingerprint_fastly_compute_integration.module.compute_asset
  3. Import the Fastly service

    terraform import \
      module.fingerprint_fastly_compute_integration.fastly_service_compute.fingerprint_integration \
      "<your empty fastly compute service id>"
  4. Apply the changes

    terraform apply

3. Add the proxy secret to your Fastly Secret Store

  1. Using the Fastly web interface, open the Secret Store created for your service by Terraform. It will be named Fingerprint_Compute_Secret_Store_<SERVICE_ID>.
  2. Add a PROXY_SECRET item with your Fingerprint proxy secret as the value.

Using a Custom package

To use your own .tar.gz package instead of downloading the official release, please see Using a custom build in the full integration guide.

This is only necessary if you're using Open Client Response.

Examples

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:

How to update

The Terraform module does include any mechanism for automatic updates. To keep your integration up to date, please run terraform apply regularly.

More resources

License

This project is licensed under the MIT license. See the LICENSE file for more info.