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

mongodb adddon produce module crash #82

Closed
fdelrieu-klanik opened this issue Jul 12, 2024 · 3 comments · Fixed by #83 or #84
Closed

mongodb adddon produce module crash #82

fdelrieu-klanik opened this issue Jul 12, 2024 · 3 comments · Fixed by #83 or #84
Assignees

Comments

@fdelrieu-klanik
Copy link

Hello,

seems that mongodb resource is broken since not so long ago,
it produce a go panic error on apply.

Have a good day.

Terraform Version

Terraform v1.6.4

Affected Resource(s)

  • mongodb

Terraform Configuration Files

db = {
  staging = {
    "plan"   = "XS_SML"
    "name"   = "xxxxxxxxxxxxxxxxxx-pg-staging"
    "type"   = "md"
    "region" = "par"
  }
  production = {
    "plan"   = "XS_SML"
    "name"   = "xxxxxxxxxxxxxxxxxx-pg-production"
    "region" = "par"
    "type"   = "md"
  }
}
resource "clevercloud_mongodb" "mongodb" {
  count  = var.db[local.env].type == "md" ? 1 : 0
  name   = var.db[local.env].name
  plan   = var.db[local.env].plan
  region = var.db[local.env].region
}

Panic Output


Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # clevercloud_mongodb.mongodb[0] will be created
  + resource "clevercloud_mongodb" "mongodb" {
      + creation_date = (known after apply)
      + host          = (known after apply)
      + id            = (known after apply)
      + name          = "klanikdotcom-pg-staging"
      + password      = (known after apply)
      + plan          = "XS_SML"
      + port          = (known after apply)
      + region        = "par"
      + user          = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.
clevercloud_mongodb.mongodb[0]: Creating...
╷
│ Warning: Resource targeting is in effect
│
│ You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
│
│ The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵
╷
│ Warning: Applied changes may be incomplete
│
│ The plan was created with the -target option in effect, so some changes requested in the configuration may have been ignored and the output values may not be fully updated. Run the following command to verify that no other changes are pending:
│     terraform plan
│ 	
│ Note that the -target option is not suitable for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵
╷
│ Error: Request cancelled
│
│ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-clevercloud_v0.4.0 plugin:

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

goroutine 58 [running]:
go.clever-cloud.com/terraform-provider/pkg/resources/mongodb.(*ResourceMongoDB).Create(0xc00056d3b0, {0x1088448, 0xc0006288d0}, {{{{0x108e758, 0xc000629350}, {0xdb8cc0, 0xc000629200}}, {0x1090718, 0xc0003b2280}}, {{{0x108e758, ...}, ...}, ...}, ...}, ...)
	go.clever-cloud.com/terraform-provider/pkg/resources/mongodb/crud.go:52 +0x21e
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0xc000173ba0, {0x1088448, 0xc0006288d0}, 0xc00068f580, 0xc00068f520)
	github.com/hashicorp/terraform-plugin-framework@v1.7.0/internal/fwserver/server_createresource.go:101 +0x578
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0xc00068f6d8?, {0x1088448, 0xc0006288d0}, 0xc00055f720, 0xc00068f6d8)
	github.com/hashicorp/terraform-plugin-framework@v1.7.0/internal/fwserver/server_applyresourcechange.go:57 +0x4a5
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0xc000173ba0, {0x1088448?, 0xc0006287b0?}, 0xc00055f680)
	github.com/hashicorp/terraform-plugin-framework@v1.7.0/internal/proto6server/server_applyresourcechange.go:55 +0x3e5
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc000234be0, {0x1088448?, 0xc000579dd0?}, 0xc0003696c0)
	github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/tf6server/server.go:846 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0xed2200?, 0xc000234be0}, {0x1088448, 0xc000579dd0}, 0xc00014f100, 0x0)
	github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:518 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00014b600, {0x1088448, 0xc000579d40}, {0x108f328, 0xc00048a1a0}, 0xc00056fe60, 0xc00032a4e0, 0x1730938, 0x0)
	google.golang.org/grpc@v1.62.1/server.go:1386 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc00014b600, {0x108f328, 0xc00048a1a0}, 0xc00056fe60)
	google.golang.org/grpc@v1.62.1/server.go:1797 +0x100c
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/grpc@v1.62.1/server.go:1027 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 36
	google.golang.org/grpc@v1.62.1/server.go:1038 +0x135

Error: The terraform-provider-clevercloud_v0.4.0 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

Should create a DB

Actual Behavior

Crash like a plane with no wings

Steps to Reproduce

  1. terraform apply
@miton18
Copy link
Collaborator

miton18 commented Jul 12, 2024

HI @fdelrieu-klanik , thanks for the report, we will take a look

@miton18
Copy link
Collaborator

miton18 commented Jul 12, 2024

2 things:

@miton18
Copy link
Collaborator

miton18 commented Jul 12, 2024

@fdelrieu-klanik We will handle this case to prevent a panic.

Your issue come from the plan you defined XS_SML does not exists but xs_sml yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants