-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
helper/schema: Make nested Set(s) in List(s) work #7393
helper/schema: Make nested Set(s) in List(s) work #7393
Conversation
Although DiffFieldReader was the one mostly responsible for a buggy behaviour more tests were added throughout the debugging process most of which would fail without the bugfix. - ResourceData - MultiLevelFieldReader - MapFieldReader - DiffFieldReader
8f9715e
to
37d57f4
Compare
// This should never happen, because by the time the data | ||
// gets to the FieldReaders, all the defaults should be set by | ||
// Schema. | ||
panic("missing field in list: " + strings.Join(addrPadded, ".")) |
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.
+1 for panic here - as soon as I saw the "This should never happen" in the old shared impl i was like 💭 "we should panic then!" 😀
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.
Right, that's more or less inherited from the original generic ReadList
function, but it's still valid here too. 😄
Okay! This looks great @radeksimko, especially the extensive testing work. Merge at will. 👍 🚀 |
Hello – We've found some regressions in our tests and suspect this PR. I'm going to issue a revert (#7436), but first, here are some examples:
From https://travis-ci.org/hashicorp/terraform/builds/141247532 and https://travis-ci.org/hashicorp/terraform/builds/141254784, respectively. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Related to #7253 & #7254
Supersedes/fixes #7268
Issue explained below in (hopefully) simple ASCII art.
resource schema
resource CRUD
The nested TypeSet inside TypeList was set to
nil
and any data further nested in that Set were ignored insideUpdate
function of a resource unless thatTypeSet
field was actually contained in the diff.Summary (couple of whys)
ReadList
function shared between all field readers (Diff
,Map
,Config
), this was replaced with unexported implementations per each readerDiffFieldReader
nestedConfigFieldReader
readPrimitive
and doesn't have to perform the data-type detection anymore - theoretically should save us some CPU cycles and prevent the infinite loops (one of the reasons whynestedConfigFieldReader
was there)readSet
implementation of theDiff
reader was only reading the diff and worked fine for creation/deletion of whole sets, but not so well for cases where only part of the set was being updated (contained in the diff).readSet
now fills in the gaps by getting the missing data from previous readerTests, yey
About 84% LOC of this PR are just tests covering the broken (now fixed) functionality - all contained in a separate commit.
Another PR will follow to fix the original CloudFront bug with data types.