Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirmation on timelimit for a terraform apply #57

Closed
nikhil-mongo opened this issue Nov 1, 2019 · 10 comments · Fixed by #62
Closed

Confirmation on timelimit for a terraform apply #57

nikhil-mongo opened this issue Nov 1, 2019 · 10 comments · Fixed by #62
Labels

Comments

@nikhil-mongo
Copy link
Collaborator

I created a create cluster file and the terraform ran for 12m to create the cluster. But then it threw 500 server error. Is this the time limit to complete a plan?

Error:
mongodbatlas_cluster.atlas_cluster: Still creating... [12m0s elapsed]

Error: error creating MongoDB Cluster: GET https://cloud.mongodb.com/api/atlas/v1.0/groups/5cd520dca6f239768087f39e/clusters/cluster-atlas: 500 (request "Server Error") 

  on cluster.tf line 1, in resource "mongodbatlas_cluster" "atlas_cluster":
   1: resource "mongodbatlas_cluster" "atlas_cluster" {

On the other hand, the cluster is created in the Atlas. And now when I run terraform destroy it shows no plan.

@themantissa
Copy link
Collaborator

themantissa commented Nov 1, 2019

Please note: Per the README support is provided under MongoDB Atlas support agreements.

It doesn't look like you hit a timeout but looking at that groups Activity Feed there is an error related to cluster-atlas about failing to execute a plan, potentially related but I don't have the ability to dig further. The 500 error here would be from Atlas, not the provider but the provider wasn't able to - for some reason - get that the cluster was created. Looks like perhaps something was amiss but I do not have enough to help further.

@themantissa
Copy link
Collaborator

Reopening issue as we have enough information now to know this is likely pointing to an issue with the Provider having a problem if a plan is executing, in this case to build a cluster, and a recoverable error is encountered, here a 500 was returned by a GET and the plan stopped - however the cluster creation did succeed and hence Terraform state and the Atlas reality did not match. The plan should not exit but continue to poll for some period of time to see if the plan did succeed. @marinsalinas or @PacoDw thoughts?

@themantissa themantissa added the bug label Nov 1, 2019
@PacoDw
Copy link
Contributor

PacoDw commented Nov 4, 2019

Thanks, @themantissa and @nikhil-mongo so much for your review, we will check what happens with it, but @nikhil-mongo can you help us sharing the Terraform configuration to recreate the issue?

@nikhil-mongo
Copy link
Collaborator Author

Hi @PacoDw

I am using Terraform v0.12.10 and the cluster.tf file is attached.The file is
cluster.txt

Also I did not make any change to the Terraform configuration, which would cause this. I believe the response to the errors like 500, where a retry should be made to check the state of the cluster will be a good idea. The purpose behind this is that Atlas has a rate limit for hitting API requests per project and this might have been reached when Terraform used the API request to track the status of the cluster.
When I try to use the same file now, I am getting this error
error.txt which means that terraform is still trying to read the cluster status.

The terraform.tfstate file is
terraform_state.txt.
Please note that I had terminated the cluster from the Atlas UI.
Let me know if I need to send you anything else.

@PacoDw
Copy link
Contributor

PacoDw commented Nov 4, 2019

Thank you so much! We will figure out this on ASAP 👍

@PacoDw
Copy link
Contributor

PacoDw commented Nov 7, 2019

Hi, @nikhil-mongo,
I tried to recreate the issue with the recent changes, and I didn't have any error about it, just a little issue that's resolved. Could you plz download the latest changes and test it again?

If you have another concern or comment plz let us know

@PacoDw PacoDw closed this as completed in #62 Nov 8, 2019
@nikhil-mongo
Copy link
Collaborator Author

Hi @PacoDw

Thanks for all the efforts. It is not that API would hit 500 error each time. But with the latest plugin updated in my terraform on local machine, it is working great at the moment. Hopefully, it should not panic again.

Also to mention, when terraform panic and did not continue with the deployment, how could it still be looking for the same cluster with the data dependencies when I tried to apply the same .tf file again. It showed that it could not state the cluster and is unaware of the cluster deployed. I had provided this in my last comment as well.

Thanks.

@PacoDw
Copy link
Contributor

PacoDw commented Nov 8, 2019

You are welcome, thank you so much for your review

@nikhil-mongo
Copy link
Collaborator Author

Hi @PacoDw and @themantissa ,

The above issue has been encountered again.

Below is the error:

Error: error deleting MongoDB Cluster (cluster-atlas): DELETE https://cloud.mongodb.com/api/atlas/v1.0/groups/5cd520dca6f239768087f39e/clusters/cluster-atlas: 500 (request "Internal Server Error") Unexpected error.

But the request succeeds and now Terraform still gives me the option to destroy the cluster and encounters 400 error each time. This has somewhat corrupted by tfstate file.

  • provider.mongodbatlas: version = "~> 0.2"

Please reopen this issue.

@themantissa
Copy link
Collaborator

@nikhil-mongo please ensure you are testing with the most recent version, which is 0.3.1.
https://github.com/terraform-providers/terraform-provider-mongodbatlas/blob/master/CHANGELOG.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants