Search code examples
mongodbazureterraform

Get api keys from azure key vault, for mongodb atlas provider in Terraform


I'm using Terraform to deploy a mongodb atlas instance on azure, but now I have to use the API keys to authenticate the mongodb provider in Terraform, but this is not really safe looking to me, so I want to put them in a key vault. But now it's unclear to me how I can read out the keyvault at the moment that the provider is constructed in Terraform.

With variables it's working:

provider "mongodbatlas" {
  public_key  = var.mongodb_atlas_api_pub_key
  private_key = var.mongodb_atlas_api_pri_key
}

But I would like it that I can get those secrets from key vault.


Solution

  • I concluded that this is not doable, and that they need do be hardcoded.