Please adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_rate_limit" "backend_rate_limit" {
provider = konnect-beta
type = "MeshRateLimit"
name = "backend-rate-limit"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "backend"
}
}
rules = [
{
default = {
local = {
http = {
request_rate = {
num = "5"
interval = "10s"
}
on_rate_limit = {
status = "423"
headers = {
set = [
{
name = "x-kuma-rate-limited"
value = "true"
}
]
}
}
}
}
}
}
]
}
labels = {
"kuma.io/mesh" = konnect_mesh.my_mesh.name
}
cp_id = konnect_mesh_control_plane.my_meshcontrolplane.id
mesh = konnect_mesh.my_mesh.name
}