Azurerm api management named value limitation

Hi,

We’re using the azurerm_api_management_named_value to add named values inside the azurerm_api_management, but we encounter a limitation on the Terraform side. The “value” parameter only takes “String” as data type. In our use case, our named value needs to contain a list of allowed cidr blocks that can communicate with the api.
The problem is that “value” does not accepts any other formats other than “String”, so when trying to create a list of cidr blocks it just doesn’t work.

In portal in the value field a list of strings is allowed (see image belwo).

image

Hi @eplr3198
Sorry I can’t answer your question. But perhaps you can help me ^^’
How are you referring to named values in policy file?
Considering following resource:
resource “azurerm_api_management_named_value” “global_forward_request_timeout” {
name = “global-forward-request-timeout”
api_management_name = azurerm_api_management.apim.name
resource_group_name = azurerm_resource_group.apim_rg.name
display_name = “global-forward-request-timeout”
value = var.global-forward-request-timeout
}

Using as follows in policy file is giving an error during apply step.

The API/SDK only supports string values here. The value in your screenshot is still a string, it just happens to be valid JSON.

You might want to look at the jsonencode() function.