curl -X POST https://{region}.api.konghq.com/v1/event-gateways/{eventGatewayId}/virtual-clusters/{virtualClusterId}/consume-policies \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $KONNECT_TOKEN" \
--data '
{
"name": "skip-record-nested",
"type": "skip_record",
"parent_policy_id": "'$PARENT_POLICY_ID'",
"condition": "record.value.content[\"name\"].endsWith(\"my_suffix\")"
}
'
Make sure to replace the following placeholders with your own values:
-
region: Geographic region where your Kong Konnect is hosted and operates.
-
KONNECT_TOKEN: Your Personal Access Token (PAT) associated with your Konnect account.
-
virtualClusterId: The id of the Virtual Cluster.
-
eventGatewayId: The id of the Event Gateway.
-
eventGatewayListenerId: The id of the Event Gateway Listener.
See the Konnect Event Gateway API reference to learn about region-specific URLs and personal access tokens.
Prerequisite: Configure your Personal Access Token
terraform {
required_providers {
konnect-beta = {
source = "kong/konnect-beta"
}
}
}
provider "konnect-beta" {
personal_access_token = "$KONNECT_TOKEN"
server_url = "https://us.api.konghq.com/"
}
resource "konnect_event_gateway_consume_policy_skip_record" "my_virtual_cluster_policy_skip_record" {
provider = konnect-beta
type = "skip_record"
parent_policy_id = var.parent_policy_id
condition = "record.value.content[\"name\"].endsWith(\"my_suffix\")"
virtual_cluster_id = konnect_event_gateway_virtual_cluster.my_virtual_cluster.id
gateway_id = konnect_event_gateway.my_event_gateway.id
}
This example requires the following variables to be added to your manifest. You can specify values at runtime by setting TF_VAR_name=value.
variable "parent_policy_id" {
type = string
}
The following example creates a new skip_record policy.
Add this snippet to an event_gateways resource in your declarative configuration file, and then manage it with kongctl:
event_gateways:
- ref: eventGatewayName
name: eventGatewayName
virtual_clusters:
- ref: virtualClusterName
name: virtualClusterName
consume_policies:
- ref: skip-record-nested
type: skip_record
skip_record:
name: skip-record-nested
parent_policy_id: "${policy_id}"
condition: record.value.content["name"].endsWith("my_suffix")
Make sure to replace the following placeholders with your own values: