Allow to assign API Key to Project via Terraform by referencing public key
Currently you can only assign an API Key to an Atlas Project via Terraform by referencing the ID of the API Key. Unfortunately, the ID is not exposed through the UI, only through the Atlas API. This is not very ideal for customers/users that are creating API Keys through the UI.
Adding support for referencing the API Key in Terraform via the public key instead of the ID would fix this. Or alternatively, exposing the API Key ID in Atlas.
We released support for Data Source: mongodbatlas_api_keys which exposes the api_key_id paramter as part of v1.8.0. Thank you for the feedback.
For more details see: https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/data-sources/api_keys#api_key_id
-
Thank you Robbert. It's the API Key ID because that's what the API requires (https://docs.atlas.mongodb.com/reference/api/projectApiKeys/assign-one-org-apiKey-to-one-project/). This particular area was a community submission and the work to try to convert a public key to id would certainly take some work and likely be a bit tricky. It would be great to see another community member present a solution to this. However, we will keep it in consideration as we work with customers in this area.