Skip to content

objchange: fix ProposedNew from null objects#29701

Merged
jbardin merged 2 commits intomainfrom
jbardin/proposed-new-null-objs
Oct 5, 2021
Merged

objchange: fix ProposedNew from null objects#29701
jbardin merged 2 commits intomainfrom
jbardin/proposed-new-null-objs

Conversation

@jbardin
Copy link
Copy Markdown
Member

@jbardin jbardin commented Oct 4, 2021

The codepath for AllAttributesNull was not correct for any nested object
types with collections, and should create single null values for the
correct NestingMode rather than a single object with null attributes.
Since there is no reason to descend into nested object types to create
null values, we can drop the AllAttributesNull function altogether and
create null values as needed during ProposedNew.

The corresponding AllBlockAttributesNull was only called internally in 1
location, and simply delegated to schema.EmptyValue. We can reduce the
package surface area by dropping that function too and calling
EmptyValue directly.

Fixes #29697

The codepath for AllAttributesNull was not correct for any nested object
types with collections, and should create single null values for the
correct NestingMode rather than a single object with null attributes.

Since there is no reason to descend into nested object types to create
nullv alues, we can drop the AllAttributesNull function altogether and
create null values as needed during ProposedNew.

The corresponding AllBlockAttributesNull was only called internally in 1
location, and simply delegated to schema.EmptyValue. We can reduce the
package surface area by dropping that function too and calling
EmptyValue directly.
@jbardin jbardin added the 1.0-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Oct 4, 2021
@jbardin jbardin requested a review from a team October 4, 2021 19:05
@jbardin jbardin force-pushed the jbardin/proposed-new-null-objs branch from 18d3542 to 8271765 Compare October 4, 2021 21:53
Copy link
Copy Markdown
Contributor

@alisdair alisdair left a comment

Choose a reason for hiding this comment

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

This looks correct to me, but I don't understand the test failures in CI 🤔

@jbardin
Copy link
Copy Markdown
Member Author

jbardin commented Oct 5, 2021

Ah, data sources plan using an unknown prior value, which is not tested at all in the objchange package. I'll add another test for that too.

@jbardin jbardin force-pushed the jbardin/proposed-new-null-objs branch from 8271765 to 58d85fc Compare October 5, 2021 16:31
@jbardin jbardin merged commit aece887 into main Oct 5, 2021
@jbardin jbardin deleted the jbardin/proposed-new-null-objs branch October 5, 2021 17:09
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 5, 2021

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

1.0-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash on terraform plan with protocol v6 nested attributes

2 participants