Closed jypa-github closed 1 week ago
Thanks for opening this issue! Please make sure you've followed our guidelines when opening the issue. In short, to help us reproduce the issue we need:
The ticket CLOUDP-283050 was created for internal tracking.
thanks @jypa-github for creating the issue.
I've been trying to reproduce the issue but I've not been able to reproduce it, I always get a non-empty connection string.
Can you try to have a dependency from the cluster to the endpoint_service? something like:
data "mongodbatlas_advanced_cluster" "cluster" {
count = var.cluster_name == "" ? 0 : 1
project_id = var.project_id
name = var.cluster_name
depends_on = [ mongodbatlas_privatelink_endpoint_service.test ] # try this change
}
hi, note that it's also documented in advanced_cluster documentation: https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/advanced_cluster
Private connection strings are not available until the respective mongodbatlas_privatelink_endpoint_service resources are fully applied. Add a depends_on = [mongodbatlas_privatelink_endpoint_service.example] to ensure connection_strings are available following terraform apply
Is there an existing issue for this?
Provider Version
3.112.0
Terraform Version
v1.7.4
Terraform Edition
Terraform Open Source (OSS)
Current Behavior
The private end point connection string is empty. It looks like mongodbatlas_privatelink_endpoint_service deployment takes long time and before that locals block getting executed. Is there any way to return private end point enabled connection string?
something like
value = lookup(mongodbatlas_cluster.main.connection_strings[0].private_endpoint[0].srv_connection_string, azurerm_private_endpoint.main.id)
locals {
private_endpoints = { value = flatten([for cs in data.mongodbatlas_cluster.test.connection_strings : cs.private_endpoint]) } azure_private_endpoint = { value = [for pe in local.private_endpoints.value : pe if contains([for e in pe.endpoints : e.endpoint_id], azurerm_private_endpoint.atlas-group.id)] } azure_srv_connection_string = { value = length(local.azure_private_endpoint.value) > 0 ? local.azure_private_endpoint.value[0].srv_connection_string : "" } }
Terraform configuration to reproduce the issue
Steps To Reproduce
Run the terraform and see output string Standard connection string is returned but the Private end point enabled string is empty,
Logs
PLConnectionString = ""
Code of Conduct