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

Using UnmarshalWithOpts in order to ignore undefined attributes #426

Merged
merged 4 commits into from Jul 28, 2022

Conversation

bendbennett
Copy link
Contributor

Closes: #415

During unmarshalling of JSON, if there are fields which do not have a corresponding attribute in the schema an error is returned.

A PR on terraform-plugin-go addresses this issue.

The UnmarshalWithOpts function used in this PR will not be available to terraform-plugin-framework until the PR on terraform-plugin-go has been merged, tagged and released. Consequently, the build will fail on this PR until that time.

@bendbennett bendbennett requested a review from a team as a code owner July 27, 2022 07:52
@bflad bflad added the bug Something isn't working label Jul 27, 2022
@bflad bflad added this to the v0.10.1 milestone Jul 27, 2022
@bflad bflad self-assigned this Jul 27, 2022
Copy link
Member

@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.

Changes here looks good -- could you add a CHANGELOG entry file? Maybe something like

```release-note:bug
internal/fwserver: Ensured `UpgradeResourceState` calls from Terraform 0.12 properly ignored attributes not defined in the schema
```

@bflad bflad modified the milestones: v0.10.1, v0.11.0 Jul 27, 2022
@bflad
Copy link
Member

bflad commented Jul 27, 2022

I think we'll also need to update the req.RawState.Unmarshal call later down in the upgrade state handlers as well (line 150 currently) and add a covering unit test for that situation.

Copy link
Member

@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.

Looks really good! A go mod tidy and this should be good to merge. 🚀

go.sum Outdated Show resolved Hide resolved
@bflad
Copy link
Member

bflad commented Jul 28, 2022

Merging so I can update and merge in some other things. 😄

@bflad bflad merged commit efe6a2f into main Jul 28, 2022
@bflad bflad deleted the bendbennett/issues-415 branch July 28, 2022 18:25
@github-actions
Copy link

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 Aug 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to Read Previously Saved State for UpgradeResourceState TF 0.12
3 participants