Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

austinvalle
Copy link
Member

@austinvalle austinvalle commented Jul 15, 2025

Related Issue

N/A

Description

This PR introduces the implementation of the PlanAction and InvokeAction RPCs. Currently planning actions has one hook ModifyPlan (the same as ModifyPlan in managed resources, so I named it as such), and invoking has one hook Invoke (which always ends with a completed event)

The actual streaming mechanism of the protocol is hidden here since the provider always needs to respond with a single completed event, with multiple (optional) progress events in-between. To keep the interface of Invoke simple, we are just providing a function (InvokeResponse.SendProgress) for providers to call whenever they want to stream a progress event back to Terraform. Once the invoke method has finished, and the provider has set the proper data on the response, then framework automatically sends the completed event and returns.

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

No

@austinvalle austinvalle requested a review from a team as a code owner July 15, 2025 16:34
@austinvalle austinvalle added the actions Tracking PRs and issues related to the TF actions work label Jul 15, 2025
Comment on lines +31 to +35
// SendProgress will immediately send a progress update to Terraform core during action invocation.
// This function is provided by the framework and can be called multiple times while action logic is running.
//
// TODO:Actions: More documentation about when you should use this / when you shouldn't
SendProgress func(event InvokeProgressEvent)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't feel beneficial to expose much more than this function to provider developers. Open to discussion on any other ideas for improving this UX

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this design makes sense, we only need to expose progress events for now and if we want to expose other types, we can incrementally add callback functions for those types later. I doubt that we will need to expose every event type.

Copy link
Contributor

@SBGoods SBGoods left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines +31 to +35
// SendProgress will immediately send a progress update to Terraform core during action invocation.
// This function is provided by the framework and can be called multiple times while action logic is running.
//
// TODO:Actions: More documentation about when you should use this / when you shouldn't
SendProgress func(event InvokeProgressEvent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this design makes sense, we only need to expose progress events for now and if we want to expose other types, we can incrementally add callback functions for those types later. I doubt that we will need to expose every event type.

@austinvalle austinvalle merged commit 3f40cbd into main Jul 16, 2025
35 checks passed
@austinvalle austinvalle deleted the av/unlinked-action-impl branch July 16, 2025 18:51
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2025
@austinvalle austinvalle added this to the v1.16.0 milestone Sep 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
actions Tracking PRs and issues related to the TF actions work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants