In cases that deploying via Terraform is preferred follow this guide
The following should be added to your environment alongside any other standard configuration you deploy via Terraform.
Hosts
Two Host/Backend variables need to be added to the fastly_service_vcl resource:
# Netacea backends
backend {
name = "MitSvc"
address = "geo-mitigations.netacea.net"
use_ssl = true
override_host = "geo-mitigations.netacea.net"
ssl_cert_hostname = "geo-mitigations.netacea.net"
ssl_sni_hostname = "geo-mitigations.netacea.net"
port = "443"
request_condition = "Netacea Forward Request"
}
backend {
name = "CaptchaAssets"
address = "assets.ntcacdn.net"
use_ssl = true
override_host = "assets.ntcacdn.net"
ssl_cert_hostname = "assets.ntcacdn.net"
ssl_sni_hostname = "assets.ntcacdn.net"
port = "443"
request_condition = "Netacea Forward Request"
}
# Prevent Netacea backends from being selected as default
condition {
name = "Netacea Forward Request"
statement = "false"
type = "REQUEST"
}
Dictionary
A dictionary needs to be added to the fastly_service_vcl resource:
# Defines the Netacea dictionary
dictionary {
name = "netacea_edge_config"
}
To populate the variables within the dictionary, use the fastly_service_dictionary resource:
If you have not discussed advanced configuration with Netacea no variables need to be defined.
# Define the config values
items = {
api_key: var.netacea_api_key
secret_key: var.netacea_secret_key
encryption_key: var.netacea_encryption_key
integration_mode: "MITIGATE"
cookie_name: "cookieName"
captcha_cookie_name: "cCookieName"
}
# Find the netacea_edge_config dictionary
for_each = {
for d in fastly_service_vcl.example.dictionary : d.name => d if d.name == "netacea_edge_config"
}
# Link config values to the netacea_edge_config dictionary
service_id = fastly_service_vcl.example.id
dictionary_id = each.value.dictionary_id
# Declare that dictionary values must be managed by Terraform.
# Changes to this dictionary applied in any other way will be overwritten.
manage_items = true
For more information on the fastly_service_dictionary resource, see Fastly Provider docs
You will also need to ensure the following variables are defined within your environment:
variable "netacea_api_key" {
description = "Defines which Netacea Datastream is called"
type = string
sensitive = true
}
variable "netacea_secret_key" {
description = "Netacea Datastream Secret"
type = string
sensitive = true
}
variable "netacea_encryption_key" {
description = "Encrypts Netacea cookie"
type = string
sensitive = true
}
The variables will need to be populated with the values found on your associated Netacea Datastream. See here for more information on setting values.
VCL Snippets
Netacea will provide 5 VCL snippets separately, the files should be added to the relevant directory which stores your VCL snippets.
You will also need to reference these in the fastly_service_vcl resource:
snippet {
name = "netacea_integration_init"
type = "init"
content = file("./netacea/netacea_init.vcl")
priority = 45
}
snippet {
name = "netacea_integration_recv"
type = "recv"
content = file("./netacea/netacea_recv.vcl")
priority = 45
}
snippet {
name = "netacea_integration_recv_configure"
type = "recv"
content = file("./netacea/netacea_recv_configure.vcl")
priority = 46
}
snippet {
name = "netacea_integration_error"
type = "error"
content = file("./netacea/netacea_error.vcl")
priority = 45
}
snippet {
name = "netacea_integration_deliver"
type = "deliver"
content = file("./netacea/netacea_deliver.vcl")
priority = 45
}
Update each of the content field with the directory the Netacea VCLs have been stored in.
Deployment
You are now able to deploy the Netacea integration.
For more information on the fastly_service_vcl resource see Fastly provider docs.