-
Notifications
You must be signed in to change notification settings - Fork 43
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
Provider2 upgrade state rewrite #1998
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d3aa2e3
provider2 upgrade state rewrite
VenelinMartinov 8933992
address review comments
VenelinMartinov b2b198f
upgrade state tests
VenelinMartinov 899ba31
towards an integration test
VenelinMartinov f726145
remove max items one, add version meta
VenelinMartinov 2ff4869
add todos
VenelinMartinov b2a8a00
unskip cross tests
VenelinMartinov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling
schema.StateValueToJSONMap
looses information. The implementation ofschema.StateValueToJSONMap
is:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which information is lost here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate unpacking the concern a bit so we can address!
This is extracted from #1971 which we started taking as far as downstream tests.
I noticed in your previous rewrite @iwahbe you prefer passing the information via flatmap
https://github.com/pulumi/pulumi-terraform-bridge/pull/1735/files#diff-1c55ab32bd51c4f37c224239b498efca8a5b19c33cbb244231a5d6f02d301affR44
IN here we don't have easy access to flatmap but we're working with cty.Value:
If there's a way to go from cty.Value to flatmap that's better than going from cty.Value to json-ish we could use it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also noting that
ty := res.CoreConfigSchema().ImpliedType()
is not good and we need to revisit this. This is introducing the current provider's schema into the process of serializing inputs for the state upgrader which is not good - something that's going to break big time when the schema is changing.For now we should consider using the current value's implied schema, at least that is closer to the desired outcome in spirit:
Ideally we'd have some flatmap representation that is as-is preserved from the last write to Pulumi state but we do not have that yet without further work.
The fact that this was not caught also makes me think we need a test that exercises actually changing the provider schema in a breaking way and using a state upgrader to compensate for this; this would verify that bridged providers can support this. This test would have probably failed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to use flatmap. I used it previously because that was what we were doing before. We should use JSON for inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking state.stateValue.Type() can backfire as well as it can't get schema Set functions from schema etc.. Eh, no good options here until #1667 lands. Should at least comment and link that.