Skip to content

Comments

[Stacks Actions] Add Action Invocation Protocol Support#38051

Open
mutahhir wants to merge 4 commits intohashicorp:mainfrom
mutahhir:stacks-actions-sro-protobuf
Open

[Stacks Actions] Add Action Invocation Protocol Support#38051
mutahhir wants to merge 4 commits intohashicorp:mainfrom
mutahhir:stacks-actions-sro-protobuf

Conversation

@mutahhir
Copy link
Member

@mutahhir mutahhir commented Jan 12, 2026

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:

  • Updated protobuf schema definitions for action invocations
  • Regenerated Go code from .proto files
  • Added message types for action invocation lifecycle events
  • Protocol version remains at 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:

  • hashicorp/tfc-agent#1304
  • hashicorp/tfc-agent#1327
  • hashicorp/tfc-agent#1336

Atlas:

  • hashicorp/atlas#26691

References:

Target Release

1.15.x

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

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@mutahhir mutahhir requested a review from a team as a code owner January 12, 2026 14:31
@mutahhir mutahhir added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Jan 12, 2026
@mutahhir mutahhir marked this pull request as draft January 12, 2026 17:28
@mutahhir mutahhir changed the title [Stacks Actions] Update protobuf protocols to add Action Invocation support [Stacks Actions] Add Action Invocation Protocol Support Feb 16, 2026
@mutahhir mutahhir force-pushed the stacks-actions-sro-protobuf branch from 6c761a0 to 41701b3 Compare February 16, 2026 10:20
@mutahhir mutahhir marked this pull request as ready for review February 16, 2026 11:47
Copy link
Contributor

@DanielMSchmidt DanielMSchmidt left a comment

Choose a reason for hiding this comment

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

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Member Author

Choose a reason for hiding this comment

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

What a catch!

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)
RonRicardo added a commit to RonRicardo/terraform that referenced this pull request Feb 18, 2026
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog-needed Add this to your PR if the change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants