ITADN

Proper way to create a multival type condition?

#1090Closedamikolajczykpax8 创建于 2025-09-04
Resource: [fastly_ngwaf_workspace_rule](https://registry.terraform.io/providers/fastly/fastly/latest/docs/resources/ngwaf_workspace_rule) I'm trying to deploy a ngwaf_workspace_rule using Terraform provider 8.0.0, but I'm running into a blocker when it comes to defining what the API describes as `multival` conditions: Example directly form the API, not Terraform. Note the type of `multival` ``` { "type": "multival", "field": "request_header", "operator": "exists", "group_operator": "all", "conditions": [ { "type": "single", "field": "value_string", "operator": "does_not_match", "value": "^[A-Za-z0-9]{32,}$" }, { "type": "single", "field": "name", "operator": "equals", "value": "example" } ] }, ``` My first attempt at something like that was to use a basic `group_condition` like this: ``` group_condition { group_operator = "all" condition { field = "request_header.name" operator = "equals" value = "example" } condition { field = "request_header.value_string" operator = "does_not_match" value = "^[A-Za-z0-9]{32,}$" } } ``` However, while that succeeds on the speculative plan, it fails on apply: ``` Error: 400 - Bad Request Title: The request does not validate or is improperly formed Detail: Validation failed - field cannot be empty ``` If you look at the UI, when creating conditions, not condition groups, but specifically conditions; if you chose any of the "Request *" fields, you have the option to provide multiple sub-conditions. <img width="803" height="523" alt="Image" src="https://github.com/user-attachments/assets/bc8bdd02-1f16-41e5-a0fc-da71ccf7a90f" /> These are not condition groups, but conditions of type `multival` API Reference: https://www.fastly.com/documentation/signalsciences/api/#_corps__corpName__rules_post What's the proper way to Terraform one of these? Thanks in advance!
关闭于 2025-09-23 8 条评论