[Stacks Actions] Add Action Invocation Protocol Support#38051
[Stacks Actions] Add Action Invocation Protocol Support#38051mutahhir wants to merge 4 commits intohashicorp:mainfrom
Conversation
6c761a0 to
41701b3
Compare
DanielMSchmidt
left a comment
There was a problem hiding this comment.
Great work 🎉 Thank you also for the overview / context on all the PRs. I found an issue that will probably track through the other PRs, but I'll look at them as well to give you as much feedback as possible 👍
| } | ||
| } | ||
|
|
||
| message ActionInvocationStatus { |
There was a problem hiding this comment.
The status is insufficient I think. The same action could be triggered by multiple lifecycle trigger events and will then run once per event. E.g.
action "aws_cloudfront_cache_clear" "lb" { ... }
resource "aws_instance" "backend" {
...
lifecycle {
action_trigger {
events = [after_create, after_update]
actions = [action.aws_cloudfront_cache_clear.lb]
}
}
}
resource "aws_instance" "frontend" {
...
lifecycle {
action_trigger {
events = [after_create, after_update]
actions = [action.aws_cloudfront_cache_clear.lb]
}
}
}In this example action.aws_cloudfront_cache_clear would run two times, once after aws_instance.backend and once after aws_instance.frontend. The ActionInvocationInstanceInStackAddr is not uniquely identifying an invocation of an action, but an instance of an action. So a declaration of what might happen vs a specific instance of what is happening. So you need both the ActionInvocationInstanceInStackAddr as well as
oneof action_trigger {
LifecycleActionTrigger lifecycle_action_trigger = 6;
InvokeActionTrigger invoke_action_trigger = 7;
}
To identify a single action that is running. Same goes for the ActionInvocationProgress message, plans.ActionInvocationInstance already has this info so you probably don't need it twice for PlanActionInvocationPlanned
This disambiguates multiple invocations of the same action instance (see this excellent comment by @DanielMSchmidt for a better overview (https://github.com/hashicorp/terraform/pull/38051/changes#r2812460131)
Include the action trigger (lifecycle or invoke) in ActionInvocationStatus and ActionInvocationProgress messages to uniquely identify action invocations triggered by different events. Additional context: hashicorp#38051 (comment)

Description
This PR updates the Stacks protobuf protocols to support Action Invocation messages. It regenerates protobuf code for dependencies and introduces new message types for communicating action invocations between Terraform, TFC Agent, and Atlas.
Key protocol changes:
3(backward compatible additions)This is a foundational change that establishes the communication layer. The actual implementation logic that uses these protocols comes in subsequent PRs.
RFC: https://hermes.hashicorp.services/document/1qNke5ZCTNMQIw-rPietiHbHlV0zJELDtDftTeN2RjVc
Jira: https://hashicorp.atlassian.net/browse/TF-33014
Related PRs
This PR is part of the Stacks Actions - Lifecycle Triggered Action Invocations project.
Terraform:
TFC Agent:
Atlas:
References:
Target Release
1.15.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry