1 / 1
Oct 2024

I am managing mongoDB clusters via terraform. I recently decided to utilize an online archive for a collection to store old data that we will rarely need to access. The terraform addition was pretty simple :

resource "mongodbatlas_online_archive" "online_archive_transaction_history" { project_id = mongodbatlas_project.project.id cluster_name = mongodbatlas_advanced_cluster.cluster.name ... }

I have noticed that when this resource was created, 2 federated database instances were created

I would like to automatically pull the connection strings for these instances (for storage in kubernetes secrets) so that some microservices I have running in EKS can use them.

I can see that there is a terraform data source for them

data "mongodbatlas_federated_database_instance" "online_archive_federated_database_instance" { project_id = mongodbatlas_project.project.id name = ? }

however it requires a ‘name’ field and I do not know what value to put in there (the documention here Terraform Registry is unhelpful).

I also considered trying to provision a mongodbatlas_federated_database_instance myself, but again the documentation in the terraform registry is not clear on how to connect this to the mongodbatlas_online_archive resource.

Is there anyone who can clarify how I can create a federated_database_instance connected to an online_archive via terraform and/or how to pull the information on the automatically generated ones?