Closed srashish closed 3 years ago
Thank you for the report @srashish. Looks like perhaps the state of the existing cluster is not getting refreshed with the new stings. I'm assuming a refresh was run?
@nikhil-mongo would you be able to repro since we have no logs included here? That speeds up our ability to narrow in quickly.
@srashish Please share the cluster URL for which you are trying to do this. You can share the URL at nikhil.singh@mongodb.com for privacy.
@srashish Also another question -
@nikhil-mongo I used 'data' keyword to fetch details of the existing cluster.
Hi @srashish The data block only has 2 arguments by default, which are project_id
and name
. And this is why when the plan runs, it says this is empty string.
In order to get the connection string, use terraform import command to import the cluster into terraform and then refer to the connection string from the resource block directly.
@nikhil-mongo I think the issue is misunderstood here. I'm creating privatelink resource on an existing cluster. The privatelink is successfully created but there's a delay in its status, due to that delay I get an empty map error on the output.
Using data keyword I'm reading everything of the cluster but terraform reads it way before clearing the privatelink link, so for now I'm using a workaround with a custom delay and depends on. Ideally, this delay should be handled on the provider side.
Please let me know if there's still any confusion.
We are facing a possible related issue when creating new clusters with a private VPC endpoint where the private endpoint details are not available after the cluster and endpoint reported completed by Terraform.
mongodbatlas_cluster.this.connection_strings[0].private_endpoint
is empty list of object`
A re-run of the same terraform apply
right after such failure gives back the correct output.
This does however not happen on every deployment we do, but in rare occasions this issue is there.
We are facing a possible related issue when creating new clusters with a private VPC endpoint where the private endpoint details are not available after the cluster and endpoint reported completed by Terraform.
mongodbatlas_cluster.this.connection_strings[0].private_endpoint
is empty list of object`A re-run of the same
terraform apply
right after such failure gives back the correct output.This does however not happen on every deployment we do, but in rare occasions this issue is there.
@nikhil-mongo This is same what I'm facing. I'm able to resolve it with the workaround I mentioned above. I hope it helps to resolve the issue soon.
@shum any thoughts here on the delay?
My guess by looking at what appears in MongoDB web UI is that your provider is returning as soon as Atlas Endpoint Service Status
is Ready for connection requests
doesn't wait for Endpoint Status
to become Available
.
If you don't want to do this by default, you could add wait_for
ala kubernetes provider: https://www.hashicorp.com/blog/wait-conditions-in-the-kubernetes-provider-for-hashicorp-terraform
Just looked and we are waiting for available. I think what might be happening is the cluster resource is not being updated with the new connection string in the same apply - which is why the 2nd apply works. I'll check with our developers to verify my assumption here.
Internal ticket INTMDB-198
Internal ticket INTMDB-198
@themantissa Any updates here? Or how long the fix will take?
@srashish we are investigating a way to address this timing issue and hope to have an improvement for the next provider version. Unknown on ETA at this time.
Can this be put out into a new release please?
@zf-tomdesmet this will be in our next release, 1.0.0. We are working to finish up the required items and hope to release in the near term. Thanks!
1.0.0 is out today, thanks!
Thank you, will give it a try.
Terraform CLI and Terraform MongoDB Atlas Provider Version
Terraform Configuration File
altas_cluster.tf
Steps to Reproduce
terraform init
terraform apply
Expected Behavior
Actual Behavior
Additional Context
I'm creating privatelink on an existing cluster and according to the example I need to pass in cluster name in the lookup function to fetch the pl_string so, for that purpose, I'm using "data" resource of terraform to get cluster information and then passing it to lookup function
References
aws-atlas-privatelink