terraform-google-sql-db icon indicating copy to clipboard operation
terraform-google-sql-db copied to clipboard

error in terraform destroy

Open shi-ron opened this issue 3 years ago • 0 comments

TL;DR

while destroying the application with postgresql, there is an error:

│ Error: Error, failed to deleteuser app-user in instance test-db: googleapi: Error 400: Invalid request: failed to delete user app-user: . role "app-user" cannot be dropped because some objects depend on it Details: 112 objects in database app-database., invalid │

Destroy can only be done in the second try.

Expected behavior

No response

Observed behavior

No response

Terraform Configuration

module "sql" {
  source               = "GoogleCloudPlatform/sql-db/google//modules/postgresql"
  version    = "11.0.0"
  random_instance_name = false
  name                 = "test-db"
  database_version     = local.pg_version
  project_id           = var.project_id
  zone                 = "${var.region}-b"
  region               = var.region
  tier                 = var.tier
  user_name            = var.db_user
  db_name              = var.db_name
  user_password        = local.user_password
  encryption_key_name  = local.key


  user_labels = var.user_labels

  deletion_protection = false

  ip_configuration = {
    ipv4_enabled        = false
    private_network     = "projects/${var.network}"
    require_ssl         = true
    authorized_networks = var.authorized_networks
    allocated_ip_range  = null
  }

  backup_configuration = {
    enabled                        = true
    start_time                     = var.backup_start_time
    point_in_time_recovery_enabled = var.point_in_time_recovery_enabled
    retained_backups               = 7
    retention_unit                 = "COUNT"
    location                       = null
    transaction_log_retention_days = null
  }
}

Terraform Version

Terraform v1.2.3
on linux_amd64
+ provider registry.terraform.io/gavinbunney/kubectl v1.14.0
+ provider registry.terraform.io/hashicorp/google v4.11.0
+ provider registry.terraform.io/hashicorp/google-beta v4.14.0
+ provider registry.terraform.io/hashicorp/helm v2.6.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.12.1
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/hashicorp/random v3.3.2

Additional information

No response

shi-ron avatar Jul 18 '22 12:07 shi-ron