-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Add actions to provider interface #37006
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
base: main
Are you sure you want to change the base?
Conversation
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.
Approving the protocol changes
Will the version of the protocol version stay at 6.10? |
f3d5ac9
to
0b0cfdd
Compare
} | ||
} | ||
|
||
|
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.
nitpick: extra newline
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 left a couple of questions and comments - I won't make a fuss about the nitpicks (like newlines) so feel free to fix or ignore those as you will. Overall this looks reasonable to me!
@@ -875,3 +932,80 @@ message ConfigureStateStore { | |||
repeated Diagnostic diagnostics = 1; | |||
} | |||
} | |||
|
|||
|
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.
extra newlines
} | ||
} | ||
|
||
|
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.
(2) extra newlines
linkedResouceSchemas := actionSchema.LinkedResources() | ||
inputLinkedResources := make([]providers.LinkedResourcePlanData, 0, len(req.LinkedResources)) | ||
|
||
for i, lr := range req.LinkedResources { |
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 you add some comments (here or in top-level method comments) that explain why we aren't sending the planned_state to the provider, when we do for the protocol v5 version? I remember seeing you and James chat about it and I think it would help if that was captured somewhere here
|
||
priorState, err := decodeDynamicValue6(lr.PriorState, linkedResourceTy) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to decode prior state for linked resource #%d (%q) in action %q: %w", i+1, linkedResouceSchemas[i].TypeName, req.ActionType, err) |
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.
Is i+1
the correct thing to show the user here? I thought terraform generally always used [0] for the first item in a list and it seems like it'd be odd if we switched that just for actions (I could also be wrong about that given this context!)
return resp | ||
} | ||
|
||
func (p *GRPCProvider) InvokeAction(r providers.InvokeActionRequest) (resp providers.InvokeActionResponse) { |
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.
This one is just a genuine question I'm curious about, not a review:
How will the action event stream get cancelled from the terraform side (ie user ctrl-c or a timeout)? Does that get handled by the provider when tf calls Stop()
?
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package mock_tfplugin5 |
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.
mock.go is generated, is there a reason these methods can't also be generated?
This PR adds actions to the provider interface and implements the basic functionality against the provider protocol.
Fixes #
Target Release
1.13.x
CHANGELOG entry