Reputation: 370
I am trying to create a new version of key vault secret which already exists. But it always gives me error while using the below code when the secret already exist. Is there any way to create new version of secret.
resource "azurerm_key_vault_secret" "example" {
name = "test"
value = random_password.password.result
key_vault_id = data.azurerm_key_vault.keyvault.id
}
I always get this error
│ Error: A resource with the ID "https://dev-kv.vault.azure.net/secrets/test/9d2108c9695a366" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_key_vault_secret" for more information.
Upvotes: 5
Views: 4655
Reputation: 19484
Terraform is using state file, unfortunately it does not support upsert. So you have 3 options here.
Upvotes: 7