I am trying to create APIs in azure API Management dynamically as I have a project which has 10-15 APIs. For that I have been trying to generate azurerm_api_management_api resource block with dynamic block inside. I am passing the property values for name, version, display_name etc. Here is the code.
resource "azurerm_api_management_api" "apim_api" {
revision = "1"
resource_group_name = var.resource_group_name
api_management_name = azurerm_api_management.apim.name
dynamic apiValues{
for_each = local.apiDetails
content{
name = apiValues.value.name
display_name = apiValues.value.display_name
path = ""
protocols = ["http","https"]
service_url = "http://spring-boot-redis.azurewebsites.net"
import {
content_format = "openapi-link"
content_value = "./SpringBootRedis.yaml"
}
}
}
}
But the error says Dynamic Block is not supported
Error: Unsupported block type
│
│ on api-management\api_management_api.tf line 6, in resource "azurerm_api_management_api" "apim_api":
│ 6: dynamic apiValues{
│
│ Blocks of type "apiValues" are not expected here.
Is there a way to achieve this?