hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.32k stars 1.73k forks source link

resource google_sql_database_instance crash durning plan/apply #6015

Closed mnothic closed 4 years ago

mnothic commented 4 years ago

Terraform Version

terraform version Terraform v0.12.6

Your version of Terraform is out of date! The latest version is 0.12.24. You can update by downloading from www.terraform.io/downloads.html

Affected Resource(s)

Terraform Configuration Files

resource "google_sql_database_instance" "default" {
  project          = var.project_id
  name             = var.name
  database_version = var.database_version
  region           = var.region

  settings {
    tier                        = var.tier
    activation_policy           = var.activation_policy
    availability_type           = var.availability_type
    backup_configuration {
      binary_log_enabled = var.backup_configuration.binary_log_enabled
      enabled = var.backup_configuration.enabled
      start_time = var.backup_configuration.start_time
    }

    ip_configuration {
      ipv4_enabled = var.ip_configuration.ipv4_enabled
      private_network = var.ip_configuration.private_network
      require_ssl = var.ip_configuration.require_ssl
      dynamic "authorized_networks" {
        for_each = var.ip_configuration.authorized_networks
        content {
          expiration_time = authorized_networks.value.expiration_time
          name            = authorized_networks.value.name
          value           = authorized_networks.value.value
        }
      }
    }

    disk_autoresize = var.disk_autoresize
    disk_size       = var.disk_size
    disk_type       = var.disk_type
    pricing_plan    = var.pricing_plan
    user_labels     = var.user_labels
    dynamic "database_flags" {
      for_each = var.database_flags
      content {
        name    = database_flags.value.name
        value  = database_flags.value.value
      }
    }

    maintenance_window {
      day          = var.maintenance_window_day
      hour         = var.maintenance_window_hour
      update_track = var.maintenance_window_update_track
    }
  }

  timeouts {
    create = var.create_timeout
    update = var.update_timeout
    delete = var.delete_timeout
  }

  depends_on = [var.private_ip_range_depndency]
}

Debug Output

Panic Output

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

module.network.google_compute_network.network: Refreshing state... [id=net-shared-tools-prod]
module.network.google_compute_global_address.private_ip_range: Refreshing state... [id=net-shared-tools-prod-network]
module.network.google_service_networking_connection.private_ip_range: Refreshing state... [id=https%3A%2F%2Fwww.googleapis.com%2Fcompute%2Fv1%2Fprojects%2Fprod-shared-tools%2Fglobal%2Fnetworks%2Fnet-shared-tools-prod:servicenetworking.googleapis.com]
module.postgresql.google_sql_database_instance.default: Refreshing state... [id=shared-tools-prod]
module.postgresql.random_id.user-password: Refreshing state... [id=HNJollBq95Y]
module.postgresql.google_sql_database.default: Refreshing state... [id=shared-tools-prod:default-not-used]
module.postgresql.google_sql_user.default: Refreshing state... [id=default-not-used//shared-tools-prod]

------------------------------------------------------------------------

Error: rpc error: code = Unavailable desc = transport is closing


panic: runtime error: invalid memory address or nil pointer dereference
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5: [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x1972107]
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5: 
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5: goroutine 26 [running]:
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).PlanResourceChange(0xc00000e008, 0x34c09c0, 0xc000565050, 0xc0002c0960, 0xc00000e008, 0xc000565050, 0xc0008e5b30)
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:739 +0xff7
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_PlanResourceChange_Handler(0x2ff7380, 0xc00000e008, 0x34c09c0, 0xc000565050, 0xc0002c07e0, 0x0, 0x34c09c0, 0xc000565050, 0xc000869a80, 0x19f2)
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3171 +0x217
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000085080, 0x34f4e60, 0xc0001d2c00, 0xc00057a500, 0xc0003d2ed0, 0x42f64a8, 0x0, 0x0, 0x0)
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc/server.go:1024 +0x4f4
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5: google.golang.org/grpc.(*Server).handleStream(0xc000085080, 0x34f4e60, 0xc0001d2c00, 0xc00057a500, 0x0)
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc/server.go:1313 +0xd97
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0000361e0, 0xc000085080, 0x34f4e60, 0xc0001d2c00, 0xc00057a500)
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc/server.go:722 +0xbb
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-03-31T19:46:53.388+0200 [DEBUG] plugin.terraform-provider-google_v3.15.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-google/vendor/google.golang.org/grpc/server.go:720 +0xa1
2020/03/31 19:46:53 [ERROR] module.postgresql: eval: *terraform.EvalDiff, err: rpc error: code = Unavailable desc = transport is closing
2020/03/31 19:46:53 [ERROR] module.postgresql: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/03/31 19:46:53 [TRACE] [walkPlan] Exiting eval tree: module.postgresql.google_sql_database_instance.default
2020/03/31 19:46:53 [TRACE] vertex "module.postgresql.google_sql_database_instance.default": visit complete
2020/03/31 19:46:53 [TRACE] vertex "module.postgresql.google_sql_database_instance.default": dynamic subgraph encountered errors
2020/03/31 19:46:53 [TRACE] vertex "module.postgresql.google_sql_database_instance.default": visit complete
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.output.instance_server_ca_cert" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.google_sql_database.default" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.output.instance_address" errored, so skipping
2020-03-31T19:46:53.390+0200 [DEBUG] plugin: plugin process exited: path=/Users/themanda/ubeeqo/emobg-infra-tech/shared-tools/envs/prod/infra/.terraform/plugins/darwin_amd64/terraform-provider-google_v3.15.0_x5 pid=73159 error="exit status 2"
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.output.instance_first_ip_address" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.output.instance_service_account_email_address" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.output.instance_self_link" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.output.instance_connection_name" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.output.instance_name" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.random_id.user-password" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.output.generated_user_password" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "provider.random (close)" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.google_sql_user.default" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.google_sql_user.additional_users" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "module.postgresql.google_sql_database.additional_databases" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "provider.google (close)" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/03/31 19:46:53 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/03/31 19:46:53 [INFO] backend/local: plan operation completed
2020-03-31T19:46:53.469+0200 [DEBUG] plugin: plugin exited
2020-03-31T19:46:53.472+0200 [DEBUG] plugin: plugin process exited: path=/Users/themanda/.terraform.d/plugins/darwin_amd64/terraform-provider-random_v2.2.1_x4 pid=73158
2020-03-31T19:46:53.472+0200 [DEBUG] plugin: plugin exited
2020-03-31T19:46:53.472+0200 [DEBUG] plugin: plugin process exited: path=/usr/local/Cellar/tfenv/1.0.1/versions/0.12.6/terraform pid=73157
2020-03-31T19:46:53.472+0200 [DEBUG] plugin: plugin process exited: path=/usr/local/Cellar/tfenv/1.0.1/versions/0.12.6/terraform pid=73142
2020-03-31T19:46:53.472+0200 [DEBUG] plugin: plugin exited
2020-03-31T19:46:53.472+0200 [DEBUG] plugin: plugin exited

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Expected Behavior

Actual Behavior

when you setup the disk_autoresize to true and disk_size increase automatically in this case the initial value stay inferior just crash on plan in my case but you can reproduce immediately increasing the disk size in the console by hand

Steps to Reproduce

  1. Create a google_sql_database_instance setting the disk_size initial value you choose
  2. Increment the disk_size value on google console
  3. terraform plan if you sync the value again the crash won't be appear again, so probably on code wasn't prepared to retrieve de changes from API and doesn't raises an error just crash
edwardmedia commented 4 years ago

@mnothic there are a lot of variables. Can you post the values for them, as well as the full debug log? Thanks

mnothic commented 4 years ago

ok I will update if I get the time crash will be fixed syncing the disk_size just in case!

danawillow commented 4 years ago

I don't need the full values of all the variables- just the debug log should be sufficient for me, or anything else that may have appeared in the crash output that was cut off. Thanks!

edwardmedia commented 4 years ago

@mnothic do you still have the debug log that can be shared with us?

edwardmedia commented 4 years ago

@mnothic I am closing this issue now. Please reopen it if you encounter the issue again and/or have the debug log available for us. Thank you

ghost commented 4 years ago

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 👉 hashibot-feedback@hashicorp.com. Thanks!