Skip to content

fix: registeredDomain failing on repeated contact_id updates#325

Open
alexhuk3 wants to merge 2 commits into
dnsimple:mainfrom
alexhuk3:fix/registered-domain-registrant-change
Open

fix: registeredDomain failing on repeated contact_id updates#325
alexhuk3 wants to merge 2 commits into
dnsimple:mainfrom
alexhuk3:fix/registered-domain-registrant-change

Conversation

@alexhuk3
Copy link
Copy Markdown

What

Fixes an issue where updating contact_id on a dnsimple_registered_domain succeeds on the initial change,
but fails on subsequent updates with:

error: unexpected unknown property value for "registrantChange"

Why

When a domain’s registrant contact is changed for the first time, the update completes successfully and a
registrantChange object is persisted in state.

On subsequent contact_id updates, the provider may encounter an unknown value for the
registrantChange attribute during planning, which causes the update to fail.

dnsimple:index:RegisteredDomain ... updating [diff: ~contactId]
error: unexpected unknown property value for "registrantChange"

This happens because:

  • The registrant_change object did not preserve its prior state when its value was unknown during planning
  • The update logic attempted to converge an already completed registrant change instead of creating a new one
  • Several nested attributes were marked with RequiresReplace() despite representing historical
    registrant change data rather than the domain itself

This prevents repeated registrant contact changes from being applied reliably.

How

schema.go

  • Added objectplanmodifier.UseStateForUnknown() to the registrant_change attribute to preserve the state value during planning
  • Removed RequiresReplace() from contact_id and domain_id nested attributes
  • Removed RequiresReplaceIfConfigured() from extended_attributes

update.go

  • Updated the convergence logic to only attempt convergence for pending registrant changes
  • Always create a new registrant change when contact_id differs, even if a previous change exists in a completed state

@DXTimer DXTimer added the bug label Jan 29, 2026
Copy link
Copy Markdown
Contributor

@DXTimer DXTimer left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution.

Would you mind adding a test case that covers the described scenario? This would help us guard against regressions going forward.

Comment thread internal/framework/resources/registered_domain/update.go Outdated
@maks3201 maks3201 force-pushed the fix/registered-domain-registrant-change branch from 519dd50 to 33e950f Compare April 10, 2026 11:59
Add TestAccRegisteredDomainResource_RepeatedRegistrantChange to cover
the scenario where contact_id is updated multiple times. Previously,
the second update would fail with 'unexpected unknown property value
for registrantChange'.

Also fix misleading comment in update.go about createRegistrantChange
being called unconditionally after convergence.

Signed-off-by: Maksim Ryzhukhin <eumaxpl@gmail.com>
@maks3201 maks3201 force-pushed the fix/registered-domain-registrant-change branch from 33e950f to 12aff59 Compare April 10, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants