terraform-provider-ibm icon indicating copy to clipboard operation
terraform-provider-ibm copied to clipboard

Segementation violation in 1.65.1 ibm_database

Open shemau opened this issue 9 months ago • 8 comments

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 other comments that do not add relevant new information or questions, 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

Terraform CLI and Terraform IBM Provider Version

terraform v1.5.7 ibm provider 1.65.1

Affected Resource(s)

  • ibm_database

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

https://github.com/terraform-ibm-modules/terraform-ibm-icd-elasticsearch/

resource "ibm_database" "elasticsearch" {
  depends_on                = [time_sleep.wait_for_authorization_policy]
  name                      = var.name
  plan                      = var.plan
  location                  = var.region
  service                   = "databases-for-elasticsearch"
  version                   = var.elasticsearch_version
  resource_group_id         = var.resource_group_id
  service_endpoints         = var.service_endpoints
  tags                      = var.tags
  adminpassword             = var.admin_pass
  key_protect_key           = var.kms_key_crn
  backup_encryption_key_crn = local.backup_encryption_key_crn
  backup_id                 = var.backup_crn

  dynamic "users" {
    for_each = nonsensitive(var.users != null ? var.users : [])
    content {
      name     = users.value.name
      password = users.value.password
      type     = users.value.type
      role     = (users.value.role != "" ? users.value.role : null)
    }
  }

  group {
    group_id = "member"

    memory {
      allocation_mb = var.member_memory_mb
    }

    disk {
      allocation_mb = var.member_disk_mb
    }

    cpu {
      allocation_count = var.member_cpu_count
    }

    members {
      allocation_count = var.members
    }
  }

  ## This for_each block is NOT a loop to attach to multiple auto_scaling blocks.
  ## This block is only used to conditionally add auto_scaling block depending on var.auto_scaling
  dynamic "auto_scaling" {
    for_each = local.auto_scaling_enabled
    content {
      disk {
        capacity_enabled             = var.auto_scaling.disk.capacity_enabled
        free_space_less_than_percent = var.auto_scaling.disk.free_space_less_than_percent
        io_above_percent             = var.auto_scaling.disk.io_above_percent
        io_enabled                   = var.auto_scaling.disk.io_enabled
        io_over_period               = var.auto_scaling.disk.io_over_period
        rate_increase_percent        = var.auto_scaling.disk.rate_increase_percent
        rate_limit_mb_per_member     = var.auto_scaling.disk.rate_limit_mb_per_member
        rate_period_seconds          = var.auto_scaling.disk.rate_period_seconds
        rate_units                   = var.auto_scaling.disk.rate_units
      }
      memory {
        io_above_percent         = var.auto_scaling.memory.io_above_percent
        io_enabled               = var.auto_scaling.memory.io_enabled
        io_over_period           = var.auto_scaling.memory.io_over_period
        rate_increase_percent    = var.auto_scaling.memory.rate_increase_percent
        rate_limit_mb_per_member = var.auto_scaling.memory.rate_limit_mb_per_member
        rate_period_seconds      = var.auto_scaling.memory.rate_period_seconds
        rate_units               = var.auto_scaling.memory.rate_units
      }
    }
  }

  lifecycle {
    ignore_changes = [
      # Ignore changes to these because a change will destroy and recreate the instance
      version,
      key_protect_key,
      backup_encryption_key_crn
    ]
  }

  timeouts {
    create = "120m" #Extending provisioning time to 120 minutes
  }
}

Debug Output

Panic Output

│ Error: Plugin did not respond
│ 
│   with module.elasticsearch.module.elasticsearch.ibm_database.elasticsearch,
│   on ../../main.tf line 45, in resource "ibm_database" "elasticsearch":
│   45: resource "ibm_database" "elasticsearch" {
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).PlanResourceChange call. The plugin logs may contain
│ more details.
╵

Stack trace from the terraform-provider-ibm_v1.65.1 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa882cc]

goroutine 60 [running]:
[github.com/IBM/cloud-databases-go-sdk/clouddatabasesv5.(*CloudDatabasesV5).GetEnableGzipCompression(...)](http://github.com/IBM/cloud-databases-go-sdk/clouddatabasesv5.(*CloudDatabasesV5).GetEnableGzipCompression(...))
	[github.com/IBM/[email protected]/clouddatabasesv5/cloud_databases_v5.go:179](http://github.com/IBM/[email protected]/clouddatabasesv5/cloud_databases_v5.go:179)
[github.com/IBM/cloud-databases-go-sdk/clouddatabasesv5.(*CloudDatabasesV5).GetDefaultScalingGroupsWithContext](http://github.com/IBM/cloud-databases-go-sdk/clouddatabasesv5.(*CloudDatabasesV5).GetDefaultScalingGroupsWithContext)(0x0, {0x520fd60?, 0xc000060048}, 0xc0019515f0)
	[github.com/IBM/[email protected]/clouddatabasesv5/cloud_databases_v5.go:1595](http://github.com/IBM/[email protected]/clouddatabasesv5/cloud_databases_v5.go:1595) +0x26c
[github.com/IBM/cloud-databases-go-sdk/clouddatabasesv5.(*CloudDatabasesV5).GetDefaultScalingGroups](http://github.com/IBM/cloud-databases-go-sdk/clouddatabasesv5.(*CloudDatabasesV5).GetDefaultScalingGroups)(0xc000779c20?, 0xc00234b940?)
	[github.com/IBM/[email protected]/clouddatabasesv5/cloud_databases_v5.go:1571](http://github.com/IBM/[email protected]/clouddatabasesv5/cloud_databases_v5.go:1571) +0x2a
[github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database.getDefaultScalingGroups](http://github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database.getDefaultScalingGroups)({0xc00234b940, 0x1b}, {0xc00155de70, 0xa}, {0x0, 0x0}, {0x4885ea0?, 0xc00066ca80})
	[github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database/resource_ibm_database.go:1065](http://github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database/resource_ibm_database.go:1065) +0x36c
[github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database.validateGroupsDiff](http://github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database.validateGroupsDiff)({0x0?, 0x0?}, 0xc001bd4e80, {0x4885ea0, 0xc00066ca80})
	[github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database/resource_ibm_database.go:2928](http://github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database/resource_ibm_database.go:2928) +0x1fb
[github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff.All.func1](http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff.All.func1)({0x520fdd0, 0xc0016f5680}, 0x0?, {0x4885ea0, 0xc00066ca80})
	[github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/customdiff/compose.go:53](http://github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/customdiff/compose.go:53) +0xb1
[github.com/IBM-Cloud/terraform-provider-ibm/ibm/provider.wrapCustomizeDiff.func1](http://github.com/IBM-Cloud/terraform-provider-ibm/ibm/provider.wrapCustomizeDiff.func1)({0x520fdd0?, 0xc0016f5680?}, 0x48b9a66?, {0x4885ea0?, 0xc00066ca80?})
	[github.com/IBM-Cloud/terraform-provider-ibm/ibm/provider/provider.go:1582](http://github.com/IBM-Cloud/terraform-provider-ibm/ibm/provider/provider.go:1582) +0x44
[github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff](http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff)(0xc000a30780, {0x520fdd0, 0xc0016f5680}, 0xc0016b76c0, 0xc001753800, 0xc000910200, {0x4885ea0, 0xc00066ca80}, 0x0)
	[github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:698](http://github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:698) +0x4d4
[github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff](http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff)(0x5210bd0?, {0x520fdd0?, 0xc0016f5680?}, 0xc0016b76c0, 0x4129fe0?, {0x4885ea0?, 0xc00066ca80?})
	[github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:962](http://github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:962) +0xe5
[github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange](http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange)(0xc000abd530, {0x520fdd0?, 0xc0016f5560?}, 0xc001656050)
	[github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:780](http://github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:780) +0xa09
[github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange](http://github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange)(0xc000a1c3c0, {0x520fdd0?, 0xc0016f4390?}, 0xc0015bf490)
	[github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:824](http://github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:824) +0x574
[github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler](http://github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler)({0x46fe9e0?, 0xc000a1c3c0}, {0x520fdd0, 0xc0016f4390}, 0xc0015bf420, 0x0)
	[github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:449](http://github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:449) +0x170
[google.golang.org/grpc.(*Server).processUnaryRPC](http://google.golang.org/grpc.(*Server).processUnaryRPC)(0xc0009961e0, {0x521abe0, 0xc0014dc820}, 0xc0016a9d40, 0xc0014b76e0, 0x726d080, 0x0)
	[google.golang.org/[email protected]/server.go:1358](http://google.golang.org/[email protected]/server.go:1358) +0xe23
[google.golang.org/grpc.(*Server).handleStream](http://google.golang.org/grpc.(*Server).handleStream)(0xc0009961e0, {0x521abe0, 0xc0014dc820}, 0xc0016a9d40, 0x0)
	[google.golang.org/[email protected]/server.go:1735](http://google.golang.org/[email protected]/server.go:1735) +0xa2f
[google.golang.org/grpc.(*Server).serveStreams.func1.1()](http://google.golang.org/grpc.(*Server).serveStreams.func1.1())
	[google.golang.org/[email protected]/server.go:970](http://google.golang.org/[email protected]/server.go:970) +0xca
created by [google.golang.org/grpc.(*Server).serveStreams.func1](http://google.golang.org/grpc.(*Server).serveStreams.func1)
	[google.golang.org/[email protected]/server.go:981](http://google.golang.org/[email protected]/server.go:981) +0x15c

Error: The terraform-provider-ibm_v1.65.1 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
}

Expected Behavior

This is running off our main branch, where before merging it passed and created an elastic search ICD instance.

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000

shemau avatar May 30 '24 10:05 shemau