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

Google Provider: google_sql_database_instance fails to destroy replicas w/ 409 Error #2774

Closed
chroto opened this issue Dec 31, 2018 · 1 comment
Assignees
Labels

Comments

@chroto
Copy link

chroto commented Dec 31, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • If an issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to "hashibot", a community member has claimed the issue already.

Terraform Version

$ terraform -v
Terraform v0.11.11
+ provider.google v1.20.0
+ provider.random v2.0.0

Affected Resource(s)

  • google_sql_database_instance

Terraform Configuration Files

provider "google" {
  version = "~> 1.19"
}

resource "google_sql_database_instance" "primary" {
  database_version = "${local.database_version}"

  settings {
    tier = "${local.db_tier}"

    backup_configuration {
      enabled            = "true"
      binary_log_enabled = "true"
    }
  }

  #project          = "${var.project_id}"
  #region           = "${var.region}"
}

resource "google_sql_database_instance" "failover" {
  database_version     = "${local.database_version}"
  master_instance_name = "${google_sql_database_instance.primary.name}"

  settings {
    tier = "${local.db_tier}"
  }

  replica_configuration {
    failover_target = "true"
  }

  #project          = "${var.project_id}"
  #region           = "${var.region}"
}

resource "google_sql_database_instance" "replica_0" {
  database_version     = "${local.database_version}"
  master_instance_name = "${google_sql_database_instance.primary.name}"

  settings {
    tier = "${local.db_tier}"
  }

  replica_configuration {
    failover_target = "false"
  }

  #project          = "${var.project_id}"
  #region           = "${var.region}"
}

locals {
  database_version = "MYSQL_5_7"
  db_tier          = "db-f1-micro"
}

Debug Output

Panic Output

N/A

Expected Behavior

Terraform should destroy the replica and failover instances. Then, it should destroy the primary instance.

Actual Behavior

Terraform fails to destroy the replica instance and aborts with error:

Error: Error applying plan:

1 error(s) occurred:

* google_sql_database_instance.replica_0 (destroy): 1 error(s) occurred:

* google_sql_database_instance.replica_0: Error, failed to delete instance terraform-20181231191448145000000002: googleapi: Error 409: Operation failed because another operation was already in progress., operationInProgress

Steps to Reproduce

  1. GOOGLE_PROJECT=my-project-id GOOGLE_REGION=us-central1 terraform apply
  2. GOOGLE_PROJECT=my-project-id GOOGLE_REGION=us-central1 terraform destroy

Important Factoids

N/A

References

N/A

@ghost
Copy link

ghost commented Feb 7, 2019

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 Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants