# Run Module multiple time

**URL:** <https://discuss.hashicorp.com/t/run-module-multiple-time/8023>\
**Category:** Terraform\
**Created:** [April 24, 2020, 12:39pm UTC](https://discuss.hashicorp.com/t/run-module-multiple-time/8023 "2020-04-24T12:39:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chirag1233](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/chirag1233/32/6137_2.png) [@Chirag1233](https://discuss.hashicorp.com/u/Chirag1233)\
**Post date:** [April 24, 2020, 12:39pm UTC](https://discuss.hashicorp.com/t/run-module-multiple-time/8023/1 "2020-04-24T12:39:19Z")

</div>

Hi Guys,

I am trying to run the module in the loop to deploy multiple resources of my module. I just did the quick search and found we can’t do that. I just want to know if there is any other way we can achieve this. here is the code

```auto
 module "azurepolicy_assignments" {
    source = "./Modules/AzurePolicyAssignement/"
    count = length(local.policies)

    policy_display_name = local.policies[count.index].policy_display_name
    assignment_name = local.policies[count.index].assignment_name
    policy_scope = azurerm_resource_group.hub_rg.name
    assignment_display_name = local.policies[count.index].assignment_display_name
    assignment_description = local.policies[count.index].assignment_description
    policy_parameters = local.policies[count.index].policy_parameters
    resource_exclusion_list = local.policies[count.index].resource_exclusion_list
    identity_type = local.policies[count.index].identity_type
 }

```

here is what I have in my local.tf file.

```auto
locals {
    policies = [
        {
        policy_display_name = "Allowed locations"
        assignment_name = "test2"
        assignment_display_name = "Test Policy Resources"
        assignment_description = "TESTING THE POLICY WITH THE LOOP"
        policy_parameters = jsonencode({
            "listOfAllowedLocations": {
                "value": var.listOfAllowedLocations
            }
        })
        resource_exclusion_list = []
        identity_type = "none"
    },
    {
        policy_display_name = "Allowed locations for resource groups"
        assignment_name = "test3"
        assignment_display_name = "Test Policy RG"
        assignment_description = "TESTING THE POLICY WITH THE LOOP REsource gorup"
        policy_parameters = jsonencode({
            "listOfAllowedLocations": {
                "value": var.listOfAllowedLocations
            }
        })
        resource_exclusion_list = []
        identity_type = "none"
    }
    ]
}

```

any other way to achieve this at all ?
