Lack of details for azurerm_application_gateway rewrite rule set

In azure portal, I create a rewrite set with a rewrite rule under the rule set. Here is a snippet of how it looks in Azure Portal.

We use Terraform modules to deploy Azure Application Gateway. Now, I want to include the creation of rewrite rule set with rewrite rules in the same module. Here is sample code i have for creating a single rule set with single rule,

image

but it is complaining when i add for_each or count in the rewrite_rule block, that it is not supported in the module code for writing multiple rules in the same rule_set.

And i want the ability to create multiple rule sets with multiple rules in each rule set for each backend pool in the Gateway. Looks like this is not possible when using dynamic. Any thoughts on how to accomplish this?