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

terraform apply: restore marks after unknown validation #35048

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

liamcervante
Copy link
Member

This PR updates the order of validations that happen after an ApplyResourceChange operation. Previously, we restored the sensitive marks on the new value before validating that is was wholly known. If the value was not wholly known, then a panic might occur during the UnknownAsNull fix up call that ensures there are no unknown values present.

Now, we restore the sensitive marks only after this validation has been completed. This ensures there are no sensitive marks during the UnknownAsNull function call.

This change should be safe as only validations occur between the old point and new point of mark reapplication. The attributes within the value are not exposed by these validations.

Fixes #35039

Target Release

1.8.2

Draft CHANGELOG entry

ENHANCEMENTS

  • terraform apply: Prevent panic when a provider erroneously provides

@liamcervante liamcervante added the 1.8-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Apr 22, 2024
@liamcervante liamcervante requested a review from a team April 22, 2024 15:41
@jbardin
Copy link
Member

jbardin commented Apr 22, 2024

UnknownAsNull doesn't externally appear to transform the value outside of the cty realm, so I think should be able to accept marked values. The fact that it retains some marks, drops marks from unknown values, and panics if a only a map is marked seems like an inconsistency we should fix upstream.

Copy link
Member

@jbardin jbardin 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 good in general here, since it's only delaying the applications of marks until after some more error checking, but we should check if the upstream behavior is correct in the first place.

@liamcervante liamcervante merged commit 073e070 into main Apr 23, 2024
6 checks passed
@liamcervante liamcervante deleted the liamcervante/35039 branch April 23, 2024 07:06
Copy link
Contributor

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

Copy link
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 May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.8-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.

panic while applying a plan
2 participants