Skip to content

Conversation

@leggetter
Copy link
Collaborator

Users upgrading from v2.0 to v2.1+ encountered a "Value Conversion Error"
with message "mismatch between struct and object: Struct defines fields
not found in object: deduplicate_rule" when configuring connections with
rules.

Root cause: The state upgrader was trying to unmarshal V0 state (which
lacks deduplicate_rule) into the current connectionResourceModel (which
expects it).

Changes:

  • Add V0-compatible model structs for state upgrade compatibility
  • Update state upgrader to use V0 models and convert to current models
  • Add conversion helper functions for V0 to current model migration
  • Update getRulePriority to handle DeduplicateRule
  • Add unit tests replicating issue Value Conversion Error configuring a connection with a retry rule #191 exactly
  • Add acceptance test for V0 to V1 state migration
  • Update migration guide with troubleshooting section

Fixes #191

Users upgrading from v2.0 to v2.1+ encountered a "Value Conversion Error"
with message "mismatch between struct and object: Struct defines fields
not found in object: deduplicate_rule" when configuring connections with
rules.

Root cause: The state upgrader was trying to unmarshal V0 state (which
lacks deduplicate_rule) into the current connectionResourceModel (which
expects it).

Changes:
- Add V0-compatible model structs for state upgrade compatibility
- Update state upgrader to use V0 models and convert to current models
- Add conversion helper functions for V0 to current model migration
- Update getRulePriority to handle DeduplicateRule
- Add unit tests replicating issue #191 exactly
- Add acceptance test for V0 to V1 state migration
- Update migration guide with troubleshooting section

Fixes #191
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #191 where users upgrading from Hookdeck Terraform Provider v2.0 to v2.1+ encountered a "Value Conversion Error" stating "mismatch between struct and object: Struct defines fields not found in object: deduplicate_rule" when configuring connections with rules.

Changes:

  • Added V0-compatible model structs (connectionResourceModelV0, ruleV0, etc.) that match the schema before deduplicate_rule and response_status_codes were added
  • Updated state upgrader to use V0 models when reading old state, then convert to current models
  • Added conversion functions (convertV0ToCurrent, convertRulesV0ToCurrent, etc.) to properly migrate state from V0 to V1 format
  • Updated getRulePriority to include DeduplicateRule in the correct position (priority 3)
  • Added comprehensive unit tests for the conversion logic
  • Added acceptance test verifying the issue #191 configuration works
  • Updated migration guide with troubleshooting section and workarounds

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/provider/connection/model.go Added V0 model structs (connectionResourceModelV0, ruleV0, filterRuleV0, filterRulePropertyV0, retryRuleV0) that match the pre-v2.1 schema without deduplicate_rule and response_status_codes
internal/provider/connection/stateupgrade.go Updated state upgrader to use V0 models when reading old state and added conversion functions to migrate V0 state to current format, including proper handling of new fields
internal/provider/connection/stateupgrade_test.go Added comprehensive unit tests for V0 to V1 conversion covering retry-only rules, multiple rules, empty rules, transform rules, and filter rule property conversion
internal/provider/connection/resource_test.go Added acceptance test TestAccConnectionResource_Issue191 that validates the exact configuration from issue #191 works correctly
internal/provider/connection/testdata/issue_191_retry_only.tf Added test configuration file replicating the exact setup from issue #191
templates/guides/v2.0-to-v2.1-migration.md Added troubleshooting section documenting the error and providing resolution steps including workaround for users who cannot immediately upgrade
docs/guides/v2.0-to-v2.1-migration.md Mirror of template file with same troubleshooting documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Jan 30, 2026

@leggetter I've opened a new pull request, #193, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits January 30, 2026 12:20
@leggetter leggetter merged commit 534e3af into main Jan 30, 2026
14 checks passed
@leggetter leggetter deleted the fix/rules-value-conversion-error branch January 30, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Value Conversion Error configuring a connection with a retry rule

2 participants