Skip to content

Conversation

mildwonkey
Copy link
Contributor

@mildwonkey mildwonkey commented May 13, 2025

This commit adds decoding and merging action and action_triggers inside terraform configuration. The merging behavior is consistent with other terraform objects (the very short version: attributes merge, blocks override). This is likely incomplete, but a good starting point for reviews.

I added an Actions experiment as a somewhat hacky way of keeping the functionality suppressed until we're ready for the alpha; this may never be a formal "experiment" but it's a handy feature-flag-ish-thing so we don't have to do all the work in a long-lived feature branch. (It doesn't matter much at this phase, but once we start adding action functionality this will be important). I will remove experimentsAllowed from the decodeResourceBlock method signature as soon as this is complete.

And for ✨ extra confirmation ✨ that none of this is user-facing, terraform (built from this branch) ignores any action blocks it finds: this works just fine

action "random_action" "hello_world" {
}

resource "random_pet" "meow" {
  lifecycle {
    action_trigger {
        events = [after_create, after_update]
        actions = [action.random_action.hello_world]
    }
  }
}
Terraform will perform the following actions:

  # random_pet.meow will be created
  + resource "random_pet" "meow" {
      + id        = (known after apply)
      + length    = 2
      + separator = "-"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

CHANGELOG entry

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

@mildwonkey mildwonkey added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label May 13, 2025
@mildwonkey mildwonkey force-pushed the mildwonkey/action-config branch from 02b68a9 to 53cbaed Compare May 13, 2025 15:32
@mildwonkey mildwonkey force-pushed the mildwonkey/action-config branch from 53cbaed to 5d35533 Compare May 13, 2025 15:39
@mildwonkey mildwonkey marked this pull request as ready for review May 13, 2025 15:39
@mildwonkey mildwonkey requested a review from a team as a code owner May 13, 2025 15:39
@mildwonkey mildwonkey force-pushed the mildwonkey/action-config branch from 5d35533 to 5725fe7 Compare May 13, 2025 15:55
DanielMSchmidt
DanielMSchmidt previously approved these changes May 13, 2025
This commit adds decoding of action and action_triggers inside terraform configuration. I added an Actions experiment as a hacky way of keeping the functionality out of main until we're ready for the alpha; this may never be an experiment but it's a handy feature flag so we don't have to do all the work in a long-lived feature branch.

This isn't *complete* so much as a useful checkpoint for reviewing as we build out Actions.
@mildwonkey mildwonkey merged commit 386988c into main May 14, 2025
12 of 13 checks passed
@mildwonkey mildwonkey deleted the mildwonkey/action-config branch May 14, 2025 13:07
Copy link
Contributor

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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