Client-side protection configuration

akamai_appsec_clientside_protection_configuration

Create and manage your security policy's client-side protection & compliance (CPC) configuration.

Note: This feature requires an active CPC entitlement on your account.

resource "akamai_appsec_clientside_protection_configuration" "my_cpc_config" {
  config_id          = 12345
  security_policy_id = "abcd_123456"

  edge_injection = {
    load_script_async = true
  }

  edge_test_parameters = {
    disable_injection_key   = "cpc-disable"
    disable_injection_value = "true"
    force_injection_key     = "cpc-force"
    force_injection_value   = "true"
  }

  injection_criteria = {
    injection_path_includes = "/shop/*"
    injection_path_excludes = "/shop/static/*"
    injection_percent       = 100
    injection_policy        = "head"
    script_tag_attributes   = ["nonce=\"abc123\""]
  }
}

Arguments

ArgumentRequiredDescription
config_id✔️A security configuration ID. Changing this value forces creation of a new resource.
security_policy_id✔️A security policy ID. Changing this value forces creation of a new resource.
edge_injection✔️Controls how the CPC script is loaded by the edge. Contains:
  • load_script_async. Required. When set to true, the CPC protection script loads asynchronously, reducing its impact on page load time. When false, the script loads synchronously.
edge_test_parameters✔️Query string parameters used to override script injection behavior during testing. Contains:
  • disable_injection_key. Required. A key to disable script injection for a specific request.
  • disable_injection_value. Required. The value of the disable_injection_key.
  • force_injection_key. Required. A key to force script injection for a specific request.
  • force_injection_value. Required. The value of the force_injection_key.
injection_criteria✔️Controls which requests receive the injected script and how the script tag is placed. Contains:
  • injection_percent. Required. Integer (0–100). Percentage of eligible requests that receive the injected script.
  • injection_path_includes. Glob-style path pattern for paths eligible for injection.
  • injection_path_excludes. Glob-style path pattern for paths excluded from injection.
  • injection_policy. Controls where in the HTML page the script tag is inserted.
  • script_tag_attributes. A list of custom HTML attributes added to the injected <script> tag.

Did this page help you?