-
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
Detect and reject unknown attributes in "connection" blocks #13400
Merged
Merged
Changes from all commits
Commits
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
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
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.
Can we move this functionality into the communicator package, or at least somehow get the
connConfigSuperset
definition in there? It wold be nice to have some logical locality next time we're trying to figure out why a new communicator fails validation ;)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.
A fair point... I was a little unsure where to place this because the ownership of the "schema" of this block is rather unclear anyway, with the documentation implying that there are some "global attributes" which are in fact just supported by all the communicators by convention.
However, we do have the global
communicator
package that has the function for instantiating the specific communicators, so assuming that's what you were referring to here then I agree, I'll move it over there.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.
Ugh... it turns out that this is more problematic than I initially thought because the
communicator
package already depends on theterraform
package and so we can't call into it fromterraform
without creating a dependency cycle.We've got away with this so far because it's the provisioners that call into
communicator
and the plugin indirection prevents Go from seeing it as a circular dependency.I think there is a path here where the
communicator
interface can be adjusted so that it receives directly the connection info as amap[string]interface{}
rather than getting aterraform.InstanceState
and pulling it out of there itself, but that's a bit beyond the scope of what I wanted to do for this bug.Do you think it's reasonable to move ahead with what I had here and address this later, or should I just shelve this for the moment and come back to it when there's more time for such refactoring?
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.
Hmm, that's what I was afraid of.
connConfig.Config
is already just amap[string]interface{}
; couldn't this just be a function likeand pass it
ResourceConfig.Config
?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.
That's exactly what I tried, but then that adds a dependency from
terraform
tocommunicator
, which is problematic. In order for us to call fromterraform
tocommunicator
we need to eliminate all of theterraform
dependencies fromcommunicator
itself, which I think is possible (it seems to use it only because currently communicators get passed a fullterraform.InstanceState
on init) but a pretty disruptive interface change for a relatively-minor UX improvement.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.
🤦♂️ sorry, of course, I was worrying about the inverse.
Yeah, lets have this live here for now.