Skip to content

Commit d55e148

Browse files
feat: add example
1 parent c1b28ea commit d55e148

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed

examples/main/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Main example for Fingerprint Fastly Compute Proxy Integration
2+
3+
This project is an example of how to create a Fastly Compute service for the [Fingerprint Fastly Compute proxy integration Terraform module](https://github.com/fingerprintjs/terraform-fastly-fingerprint-compute-proxy-integration).
4+
Learn more in the [Fastly Compute Proxy Terraform installation guide](https://dev.fingerprint.com/docs/deploy-fastly-compute-using-terraform).
5+
6+
### Running the example
7+
8+
To quickly run the example for testing purposes, you can:
9+
10+
1. Copy the [terraform.tfvars.example](./terraform.tfvars.example) file into a new `terraform.tfvars` file and replace the values with your own. The variables are defined and described in the [variables.tf](./variables.tf) file.
11+
2. Copy your Fastly API token
12+
3. Create an empty compute service on Fastly and copy its ID.
13+
4. Run `terraform init`.
14+
5. Run `terraform apply -target=module.fingerprint_fastly_compute_integration.module.compute_asset`
15+
6. Run `terraform import module.fingerprint_fastly_compute_integration.fastly_service_compute.fingerprint_integration "<your empty fastly compute service id>"`
16+
7. Run `terraform plan`.
17+
8. Run `terraform apply`.
18+
19+
### Using in production
20+
21+
This is a simplified example. Use it as a reference but make sure to **adjust the code to your needs and security practices** before deploying it to production environments.
22+
23+
### Additional resources
24+
25+
- [Fingerprint Fastly Compute Proxy Integration documentation](https://dev.fingerprint.com/docs/fastly-compute-proxy-integration)

examples/main/fingerprint.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module "fingerprint_fastly_compute_integration" {
2+
source = "../.."
3+
agent_script_download_path = var.agent_script_download_path
4+
get_result_path = var.get_result_path
5+
integration_domain = var.integration_domain
6+
service_id = var.service_id
7+
fastly_api_token = var.fastly_api_token
8+
}

examples/main/providers.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
terraform {
2+
required_version = ">= 1.5"
3+
required_providers {
4+
fastly = {
5+
source = "fastly/fastly"
6+
version = ">= 7.1.0"
7+
}
8+
github = {
9+
source = "integrations/github"
10+
version = "6.2.2"
11+
}
12+
}
13+
}
14+
15+
provider "fastly" {
16+
api_key = var.fastly_api_token
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
agent_script_download_path = "463N7"
2+
get_result_path = "r35U17"
3+
fastly_api_token = "YOUR_API_TOKEN_CREATED_IN_FASTLY_DASHBOARD"
4+
service_id = "YOUR_EMPTY_FASTLY_COMPUTE_SERVICE_ID_CREATED_ON_FASTLY_DASHBOARD"
5+
integration_domain = "metrics.yourwebsite.com"

examples/main/variables.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
variable "agent_script_download_path" {
2+
description = "The Fingerprint agent download will be proxied through this path"
3+
type = string
4+
default = "agent"
5+
}
6+
7+
variable "get_result_path" {
8+
description = "The Fingerprint agent download will be proxied through this path"
9+
type = string
10+
default = "result"
11+
}
12+
13+
variable "integration_domain" {
14+
description = "Domain used for your proxy integration"
15+
type = string
16+
}
17+
18+
variable "service_id" {
19+
description = "ID of your empty Fastly Compute service"
20+
type = string
21+
}
22+
23+
variable "fastly_api_token" {
24+
type = string
25+
}

0 commit comments

Comments
 (0)