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

Creating SQL instance with same name as previously deleted instance hangs #5101

Closed
ghost opened this issue Dec 6, 2019 · 5 comments · Fixed by GoogleCloudPlatform/magic-modules#2817
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Dec 6, 2019

This issue was originally opened by @jovankricka as hashicorp/terraform#23594. It was migrated here as a result of the provider split. The original body of the issue is below.


When you try to create new SQL instance that has same name as some SQL instance that was previously created, terraform hangs with "Still creating...".

Terraform Version

0.2.17

Expected Behavior

If Google provider can not create SQL instance because there is a deleted one with same name, terraform apply should give an error and break and not hang forever on "Still creating...".

Actual Behavior

Terraform apply hangs forever on "Still creating...".

Steps to Reproduce

  1. Create SQL instance with name "test" manually on GCP
  2. Delete SQL instance with name "test" manually on GCP.
  3. Create SQL instance with name "test" via terraform apply.
@venkykuberan
Copy link
Contributor

Hi @jovankricka,
I am able to reproduce the issue. Although UI/cloud console shows that sql instance has been deleted apparently its still in "PENDING_DELETE" status. API is responding with the status HTTP-409 however terraform retries it for 20 mins as per https://www.terraform.io/docs/providers/google/r/sql_database_instance.html#create and giving up after that.

Error message captured from debug mode.


{
2019-12-06T17:19:53.337-0800 [DEBUG] plugin.terraform-provider-google_v3.1.0_x5: "error": {
2019-12-06T17:19:53.337-0800 [DEBUG] plugin.terraform-provider-google_v3.1.0_x5: "code": 409,
2019-12-06T17:19:53.337-0800 [DEBUG] plugin.terraform-provider-google_v3.1.0_x5: "message": "The instance or operation is not in an appropriate state to handle the request.",
2019-12-06T17:19:53.337-0800 [DEBUG] plugin.terraform-provider-google_v3.1.0_x5: "errors": [
2019-12-06T17:19:53.337-0800 [DEBUG] plugin.terraform-provider-google_v3.1.0_x5: {
2019-12-06T17:19:53.337-0800 [DEBUG] plugin.terraform-provider-google_v3.1.0_x5: "message": "The instance or operation is not in an appropriate state to handle the request.",
2019-12-06T17:19:53.337-0800 [DEBUG] plugin.terraform-provider-google_v3.1.0_x5: "domain": "global",
2019-12-06T17:19:53.337-0800 [DEBUG] plugin.terraform-provider-google_v3.1.0_x5: "reason": "invalidState",
2019-12-06T17:19:53.337-0800 [DEBUG] plugin.terraform-provider-google_v3.1.0_x5: "debugInfo": "BossException (INVALID_STATE): Instance ':test-sql' is not accessible end user: PENDING_DELETE . {domain: cloud.sql.BossError, code: INVALID_STATE, arguments, []}\n\tat com.google.storage.speckle.boss.util.exception.BossException.invalidState(BossException.java:418)\n\tat

@venkykuberan
Copy link
Contributor

venkykuberan commented Dec 9, 2019

Hi @jovankricka,
It seems we can not reuse the same instance name for up to a week after deleting an instance. Please refer this documentation https://cloud.google.com/sql/docs/mysql/delete-instance. It can be reproduced in the UI as well.

@syedrakib
Copy link

syedrakib commented Mar 24, 2020

This GCloud doc is saying "You cannot reuse an instance name for up to a week after you have deleted an instance".

if google is declaring it, then terraform shouldn't hang like this. Terraform could try for some time and then fail saying this is a probable cause and the developer should verify.

I spent so many hours hoping for the CloudSQL to be provisioned and only now i learned it will not happen for next 7 days.

@megan07
Copy link
Contributor

megan07 commented Mar 24, 2020

Hi @syedrakib! I'm sorry you have run into this issue. It appears that the fix was released in version 3.3.0 of the provider. If you are using the 3.3.0 release or later and still seeing the issue, please open a new issue and we can take another look. Thanks!

@ghost
Copy link
Author

ghost commented Mar 25, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants