Repository navigation
fix: send clusterId in inline-create boot disk - #3
Merged
Merged
Conversation
The Fluence API's VmBootDisk oneOf create variant is a CreateUserStorageRequest, which requires clusterId. The inline-create path built a CreateUserStorageInline without it, so `terraform apply` of a cloudless_vm with an inline boot_disk failed with: 400 Input validation error: bootDisk: data did not match any variant of untagged enum VmBootDisk Thread the VM's cluster_id into the inline boot disk so the body matches the create variant. The mock server accepted the malformed body (it treats any non-string bootDisk as an inline create and synthesizes an ID), so this only surfaced against the real API. Add a bootDiskToAPI unit test asserting clusterId is populated and marshaled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
terraform applyof acloudless_vmwith an inlineboot_diskfails against the real Fluence API:Root cause
The API's
VmBootDiskoneOfcreate variant is aCreateUserStorageRequest, which requiresclusterId. The provider builtCreateUserStorageInlinewithoutclusterId, so the serialized body matched neitheroneOfvariant (not the string storage-id form, not the create form).Two reasons this slipped through:
internal/client/mock/vm.go) treats any non-stringbootDiskas an inline create and synthesizes an ID, so unit/mock tests passed.terraform planonly validates against the provider schema and never sends the create request, so the bad body only appears atapplyagainst the real API.Fix
ClusterIDtoCreateUserStorageInline(clusterIdJSON tag).cluster_idinto the inline boot disk inbootDiskToAPI.bootDiskToAPIunit test assertingclusterIdis populated and survives marshaling.Testing
go test ./...passes."clusterId":"") and passes with it.Possible follow-ups (not in this PR)
clusterId, so this class of mock/real divergence is caught in CI.replicated = falseforNVME(local storage cannot be replicated).