How do I add via terraform more than one key secret for my key vault?

I can only see 1 key and 1 secret examples.
Please assist.

You can define multiple azurerm_key_vault_secret resource eg.

using example from official site :

  • set unique resource names
  • set your key value id in all azurerm_key_vault_secret resources
resource "azurerm_key_vault_secret" "example1" {
  name         = "secret-sauce1"
  value        = "szechuan1"
  key_vault_id = azurerm_key_vault.example.id

  tags = {
    environment = "Production"
  }
}
resource "azurerm_key_vault_secret" "example2" {
  name         = "secret-sauce2"
  value        = "szechuan2"
  key_vault_id = azurerm_key_vault.example.id

  tags = {
    environment = "Production"
  }
}

Thank you for your reply. I think you can’t use the same resource twice.
I managed to succeed with a loop.

Could you share some details of the resource and outputs config on how you managed it with a loop please?

Hi, i landed at the same problem. can any of you suggest please. how did you add more than 1 secret to the keyvault.
Thank You.