Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add state preserving plan modifiers #204

Merged
merged 8 commits into from
Nov 3, 2021

Conversation

kmoe
Copy link
Member

@kmoe kmoe commented Oct 7, 2021

Closes #180

Needs careful testing.

@paddycarver
Copy link
Contributor

I updated this to be more robust around how it's handling null states, to only ever overwrite unknown values, and to preserve unknown config values (interpolated values).

I also added unit test cases verifying the above.

I think it's ready for review.

paddycarver added a commit to hashicorp/terraform-provider-corner that referenced this pull request Oct 26, 2021
Update the framework to use hashicorp/terraform-plugin-framework#204.

Add "language" as a property of user, simulating an optional+computed
value with a default.

Add "date_joined" as a property of user, simulating a write-once
computed-only value.

Update framework user tests to check actual values (which we can do,
because they're known) instead of using unnecessary regular expressions.

Check all the attributes in state for our framework user tests.

Add framework user test that language can optionally be set.

Add framework user test that language can be interpolated successfully
even with the PreserveState modifier on it.
@paddycarver paddycarver force-pushed the prior-state-helper-plan-modifiers branch from b0bf04e to 1d1b129 Compare October 28, 2021 21:54
@bflad bflad self-assigned this Nov 1, 2021
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

I'm on board with this -- just some non-blocking items to consider. 🚀

tfsdk/attribute_plan_modification.go Outdated Show resolved Hide resolved
tfsdk/attribute_plan_modification.go Outdated Show resolved Hide resolved
@bflad bflad removed their assignment Nov 1, 2021
@paddycarver paddycarver force-pushed the prior-state-helper-plan-modifiers branch from 8ddd464 to e746c9e Compare November 3, 2021 12:16
@paddycarver
Copy link
Contributor

Think I addressed the comments. Still feel good about it, @bflad?

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Excellent 🚀

kmoe and others added 8 commits November 3, 2021 07:08
Fix checking attribute state to properly handle null values.
We don't want to override the optional+computed values that actually
gain a config value, for example.
Co-authored-by: Brian Flad <bflad417@gmail.com>
@paddycarver paddycarver force-pushed the prior-state-helper-plan-modifiers branch from e746c9e to b3785d9 Compare November 3, 2021 14:08
@paddycarver paddycarver merged commit ebd91d2 into main Nov 3, 2021
@paddycarver paddycarver deleted the prior-state-helper-plan-modifiers branch November 3, 2021 14:10
@github-actions
Copy link

github-actions bot commented Dec 4, 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 Dec 4, 2021
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.

Consider Adding Attribute State Copying Plan Modifiers
3 participants