Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
596 B
2
Indexable
Never
##########main.tf##################


data "azurerm_key_vault" "example" {
  name                = "your-keyvault-name"
  resource_group_name = "your-resource-group-name"
}

dynamic "secret" {
  for_each = var.secret_names

  content {
    data "azurerm_key_vault_secret" "secrets" {
      for_each    = var.secret_names
      name        = secret.value
      key_vault_id = data.azurerm_key_vault.example.id
    }
  }
}




#############variables.tf##########



variable "secret_names" {
  type    = list(string)
  default = ["Secret1", "Secret2", "Secret3", ...] # List of secret names here
}
Leave a Comment