Skip to content

Conversation

@BohdanTkachenko
Copy link

Previously, when a user set an empty list like hostdevs = [], the provider returned null instead of [] after apply, causing "Provider produced inconsistent result after apply" errors.

The fix adds a check: when the plan has an explicitly set (non-null) list but the XML has no elements, return an empty list to preserve user intent. This applies to both nested object lists and simple value lists.

  • Import/datasource (no plan): still returns null for absent data
  • User set field = []: now correctly returns []
  • User set field = null or omitted: returns null

Fixes #1247

Previously, when a user set an empty list like `hostdevs = []`, the
provider returned `null` instead of `[]` after apply, causing
"Provider produced inconsistent result after apply" errors.

The fix adds a check: when the plan has an explicitly set (non-null)
list but the XML has no elements, return an empty list to preserve
user intent. This applies to both nested object lists and simple
value lists.

- Import/datasource (no plan): still returns null for absent data
- User set `field = []`: now correctly returns `[]`
- User set `field = null` or omitted: returns null
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.

Empty lists returned as null causing perpetual drift

1 participant