title: how to use multiple keyvaults and use loops? terraform
body: <p>I have 5 keyvaults with 5 secrets the trouble is dont want my terraform file to have 10 data blocks like this:</p>
  <pre><code>data &quot;azurerm_key_vault&quot; &quot;kv1&quot; {
    name                = &quot;mykeyvault&quot;
    resource_group_name = &quot;myrg&quot;
  }
  
  data &quot;azurerm_key_vault_secret&quot; &quot;kv1&quot; {
    name         = var.secret_name
    key_vault_id = var..key_vault_id
  }
  data &quot;azurerm_key_vault&quot; &quot;kv2&quot; {
    name                = &quot;mykeyvault&quot;
    resource_group_name = &quot;myrg&quot;
  }
  
  data &quot;azurerm_key_vault_secret&quot; &quot;kv2&quot; {
    name         = var.secret_name
    key_vault_id = var..key_vault_id
  }
  data &quot;azurerm_key_vault&quot; &quot;kv3&quot; {
    name                = &quot;mykeyvault&quot;
    resource_group_name = &quot;myrg&quot;
  }
  
  data &quot;azurerm_key_vault_secret&quot; &quot;kv3&quot; {
    name         = var.secret_name
    key_vault_id = var..key_vault_id
  }
  data &quot;azurerm_key_vault&quot; &quot;kv4&quot; {
    name                = &quot;mykeyvault&quot;
    resource_group_name = &quot;myrg&quot;
  }
  
  data &quot;azurerm_key_vault_secret&quot; &quot;kv4&quot; {
    name         = var.secret_name
    key_vault_id = var..key_vault_id
  }
  data &quot;azurerm_key_vault&quot; &quot;kv5&quot; {
    name                = &quot;mykeyvault&quot;
    resource_group_name = &quot;myrg&quot;
  }
  
  data &quot;azurerm_key_vault_secret&quot; &quot;kv5&quot; {
    name         = var.secret_name
    key_vault_id = var..key_vault_id
  }
  .....
  </code></pre>
  <p>is there any other way i can use in one block to assign 5 keyvaults data blocks and 5 secrets data blocks?</p>
  <p>Thanks</p>