resource(instance): fix provider crash when boot_disk_id is empty#471
Conversation
|
I'll get either a new acceptance test or an updated acceptance test pushed to this tomorrow. Long day! |
karencfv
left a comment
There was a problem hiding this comment.
Thanks for fixing this! I'll wait for the acceptance test to review again :)
|
Looks like there's already a test for this case terraform-provider-oxide/internal/provider/resource_instance_test.go Lines 46 to 55 in 7af9fa6 I'm surprised this only just started failing! Must have been some change in the API we didn't catch. I guess just running the existing instance tests should be fine to test this change then! |
Added a nil pointer check to prevent a nil pointer dereference
causing the provider to crash when `boot_disk_id` is empty and
`disk_attachments` is non-empty.
The following configuration now successfully applies.
```hcl
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]
}
```
Fixes #466.
ee4e812 to
8326be8
Compare
Sorry I should have been more descriptive in the pull request description. This issue only occurred when We don't have a specific test for this since the existing tests either omit both |
|
Added the acceptance test. Without this change. With this change. All instance tests. |
Added a nil pointer check to prevent a nil pointer dereference causing the provider to crash when
boot_disk_idis empty anddisk_attachmentsis non-empty.The following configuration now successfully applies.
Fixes #466.