Skip to content

oxide_instance: provider crash when boot_disk_id is empty #466

Open
@sudomateo

Description

@sudomateo

The following configuration causes a provider crash.

resource "oxide_instance" "example" {
  project_id       = data.oxide_project.example.id
  description      = "example"
  name             = "example"
  host_name        = "example"
  memory           = 1024 * 1024 * 1024
  ncpus            = 2
  disk_attachments = [oxide_disk.example.id]
}

Here's the crash.

oxide_instance.example: Creating...
╷
│ Error: Request cancelled
│
│ The plugin6.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-oxide_v0.12.0 plugin:

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

goroutine 19 [running]:
github.com/oxidecomputer/terraform-provider-oxide/internal/provider.filterBootDiskFromDisks(...)
        github.com/oxidecomputer/terraform-provider-oxide/internal/provider/resource_instance.go:1221
github.com/oxidecomputer/terraform-provider-oxide/internal/provider.(*instanceResource).Create(0xc00043aff8, {0x101c4b8, 0xc000172570}, {{{{0x1021b18, 0xc00017a4b0}, {0xd8fc60, 0xc000173da0}}, {0x1023920, 0xc000416370}}, {{{0x1021b18, ...}, ...}, ...}, ...}, ...)
        github.com/oxidecomputer/terraform-provider-oxide/internal/provider/resource_instance.go:417 +0xc73
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0xc000186a08, {0x101c4b8, 0xc000172570}, 0xc0001274c0, 0xc000127490)
        github.com/hashicorp/terraform-plugin-framework@v1.15.0/internal/fwserver/server_createresource.go:127 +0x88e
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0xc000186a08, {0x101c4b8, 0xc000172570}, 0xc00041e310, 0xc0001275e8)
        github.com/hashicorp/terraform-plugin-framework@v1.15.0/internal/fwserver/server_applyresourcechange.go:63 +0x586
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0xc000186a08, {0x101c4b8?, 0xc000172480?}, 0xc00015f770)
        github.com/hashicorp/terraform-plugin-framework@v1.15.0/internal/proto6server/server_applyresourcechange.go:71 +0x585
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc0002105a0, {0x101c4b8?, 0xc00016f950?}, 0xc00061f900)
        github.com/hashicorp/terraform-plugin-go@v0.28.0/tfprotov6/tf6server/server.go:941 +0x3b9
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0xe95340, 0xc0002105a0}, {0x101c4b8, 0xc00016f950}, 0xc00061f880, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.28.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:687 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000206200, {0x101c4b8, 0xc00016f8c0}, 0xc0004126c0, 0xc000310d50, 0x16622e8, 0x0)
        google.golang.org/grpc@v1.72.1/server.go:1405 +0x1036
google.golang.org/grpc.(*Server).handleStream(0xc000206200, {0x101cfb0, 0xc000181860}, 0xc0004126c0)
        google.golang.org/grpc@v1.72.1/server.go:1815 +0xb88
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.72.1/server.go:1035 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 17
        google.golang.org/grpc@v1.72.1/server.go:1046 +0x11d

Error: The terraform-provider-oxide_v0.12.0 plugin crashed!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions