fix(provider): guard nil MaintenanceInfo on managed service instance create - #592
Merged
ANUGRAHG merged 1 commit intoSep 10, 2026
Merged
Conversation
…create The Cloud Controller API omits maintenance_info (json omitempty) for some managed service instances. mapResourceServiceInstanceValuesToType dereferenced it unconditionally, crashing the provider with a nil pointer dereference during terraform apply. The data-source mapper already guarded the same field; this brings the resource mapper in line with it. Fixes cloudfoundry#590 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
|
|
Contributor
|
@holistis Please sign the EasyCLA agreement as formal prerequisite for the contribution |
Contributor
Author
|
Just to double check: the EasyCLA bot above already shows the commit as signed (green checkmark, "CLA Signed"). Let me know if you're seeing something different on your end. |
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.



Summary
Fixes #590. The Cloud Controller API omits
maintenance_info(json:"maintenance_info,omitempty") for some managed service instances.mapResourceServiceInstanceValuesToTypedereferenced it unconditionally, crashing the provider with a nil pointer dereference duringterraform apply(confirmed with the reporter's own reproduction: creating a cloud.govaws-rdsmanaged service instance).The data-source mapper for the same field already guards against nil (
types_service_instance.go:155-159); this brings the resource mapper in line with it, exactly matching the fix the issue reporter proposed.Test plan
TestMapResourceServiceInstanceValuesToType_NilMaintenanceInfo, which reproduces the crash against the unfixed code (panics at the reported line) and passes after the fix.go build ./...andgo vet ./cloudfoundry/...clean.go test ./cloudfoundry/provider -run TestMapResourceServiceInstanceValuesToType_NilMaintenanceInfo -vpasses.If this is useful, a mention or link back to my GitHub profile (github.com/holistis) would be appreciated.
🤖 Generated with Claude Code