Skip to content

Conversation

@PavelSusloparov
Copy link
Contributor

@PavelSusloparov PavelSusloparov commented Jan 6, 2026

Issue:
Terraform does not detect changes during the custom_properties updates.

Solution:
Use field hashing and consistent hashing.

What changed?

  1. Complete field hashing: The hash now includes all fields (key, name, value), not just the key. This ensures Terraform can properly identify when any field changes.
  2. Consistent hashing: By using a struct and including all fields, the hash remains consistent even when Terraform's internal TypeSet mechanism calls the function multiple times.
  3. Sorted values: Values are now consistently sorted in both directions (write and read), ensuring state consistency.

Wait!

  • Have you added comprehensive tests?
  • Have you updated relevant data sources as well as resources?
  • Have you updated the docs?

Testing

For any changes you make, please ensure your acceptance test conform to the following:

  • every single new attribute is tested
  • optional attributes revert to null or default values if removed
  • attributes that interact interact as expected
  • block values behave as expected when reordered
  • nested fields on maps or list/set items function as expected. Terraform does not actually enforce most schema attributes on nested items
  • each test step for a configuration is followed by a test step where ImportState and ImportStateVerify are set to true. ImportStateVerifyIgnore can be used if we explicitly expect a value to be different when imported, such as in the case of obfuscated values like API keys

LaunchDarkly Employees

For more information on how to build, test, and release, see the internal provider runbook.

1. Complete field hashing: The hash now includes all fields (key, name, value), not just the key. This ensures Terraform can properly identify when any field changes.
2. Consistent hashing: By using a struct and including all fields, the hash remains consistent even when Terraform's internal TypeSet mechanism calls the function multiple times.
3. Sorted values: Values are now consistently sorted in both directions (write and read), ensuring state consistency.
@PavelSusloparov PavelSusloparov requested a review from a team as a code owner January 6, 2026 21:33
@tknopp-ld tknopp-ld requested a review from sloloris January 21, 2026 22:39
@sloloris sloloris changed the title fix: custom_properties hashing fix: custom_properties hashing to resolve false / missing diffs Jan 22, 2026
@sloloris sloloris changed the title fix: custom_properties hashing to resolve false / missing diffs fix: improve custom_properties hashing to resolve false / missing diffs Jan 22, 2026
Copy link
Member

@sloloris sloloris left a comment

Choose a reason for hiding this comment

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

@PavelSusloparov looks great, thank you for this!!!

@sloloris sloloris merged commit ff36941 into launchdarkly:main Jan 22, 2026
72 of 176 checks passed
This was referenced Jan 22, 2026
@sloloris
Copy link
Member

hi @PavelSusloparov, i have triggered a release. your changes should appear in v2.26.2 within a couple of hours (but probably less).

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.

2 participants