Skip to content

better determine when to plan optional+computed#32551

Merged
jbardin merged 2 commits intomainfrom
jbardin/optional-computed-null
Jan 25, 2023
Merged

better determine when to plan optional+computed#32551
jbardin merged 2 commits intomainfrom
jbardin/optional-computed-null

Conversation

@jbardin
Copy link
Copy Markdown
Member

@jbardin jbardin commented Jan 20, 2023

In the common cases we cannot determine if a null optional+computed value in the configuration was previously set when the value also exists in the state. There is however one situation where we can determine if there was previously a configuration value, we can check if a complex object in state must have at least partially come from configuration by seeing if the prior value has any non-null attributes which are not computed in the schema.

@jbardin jbardin requested a review from a team January 20, 2023 15:39
We can check if an object in state must have at least partially come
from configuration, by seeing if the prior value has any non-null
attributes which are not computed in the schema.

This is used when the configuration contains a null optional+computed
value, and we want to know if we should plan to send the null value or
the prior state.
@jbardin jbardin force-pushed the jbardin/optional-computed-null branch from 0462b84 to 8e917e5 Compare January 20, 2023 15:51
"obj": cty.ObjectVal(map[string]cty.Value{
"optional": cty.StringVal("prior"),
"computed": cty.StringVal("prior computed"),
"list_obj": cty.NullVal(cty.List(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should the comment on ll. 1992-1993 be removed?
"The entire prior nested value should be represented in the proposed new object if the configuration is null."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ooh, that's a good catch! The result is good, let me check that it's what we actually want at this point in the stack of PRs though (this was broken up from a single huge PR).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ok, this is the test I thought its was! updated the comment to describe the more accurate planning result.

Copy link
Copy Markdown
Member

@kmoe kmoe left a comment

Choose a reason for hiding this comment

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

Nice!

Base automatically changed from jbardin/optional-computed-nested-objects to main January 25, 2023 20:04
@jbardin jbardin merged commit f6af5c1 into main Jan 25, 2023
@jbardin jbardin deleted the jbardin/optional-computed-null branch January 25, 2023 20:05
@github-actions
Copy link
Copy Markdown
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@github-actions
Copy link
Copy Markdown
Contributor

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 Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants