Commit graph

23 commits

Author SHA1 Message Date
Kristin Laemmert
70e074b8aa chore (actions): rename LifecycleActionTrigger -> ResourceActionTrigger in plan and proto
We'd previously removed all other references to "lifecycle" actions, which made this reference stand out. ResourceLifecycleActionTrigger is probably the most accurate name, but as this type just needs to be differentiated from InvokeActionTrigger I thought "resource" was enough (and I specifically wanted= to avoid lifecycle at all). I'm not super attached to the name, but I did think it would be clearer if we avoided Lifecycle as much as possible, since that's got some overlap with action subtypes.

In this instance, we call it a LifecycleActionTrigger because it's come from the resource's `lifecycle` block. This doesn't directly relate to the concept of LifecycleActions - even if we expand the design to have multiple action types (for example generic and lifecycle actions), both those actions types would use this same Trigger struct.
2026-02-23 15:17:45 -05:00
Radek Simko
0fe906fa8c make copyrightfix 2026-02-17 13:56:34 +00:00
Liam Cervante
e43eeaaf2e
actions: update JSON output to include invoked actions (#37527)
* actions: update JSON output to include invoked actions

* fix more tests
2025-08-29 15:43:34 +02:00
Liam Cervante
866363ffff
actions: add invoke nodes to the graph (#37521)
* actions: add invoke graph nodes

* fix small bugs

* add additional tests

* remove whitespace

* fix copyright headers

* go generate

* address comments
2025-08-29 14:43:09 +02:00
Daniel Schmidt
3b12eb0866 actions: serialize trigger event in hooks 2025-08-25 15:01:31 +02:00
Samsondeen
1ce7d800c0
fix flaky test TestJSONHook_EphemeralOp_progress (#37451) 2025-08-18 16:39:49 +02:00
Daniel Schmidt
219c31f4eb action: move action trigger into nested struct
this prepares the work on CLI / flag-driven invocations
2025-08-18 13:53:09 +02:00
Daniel Schmidt
834665e332 use better hook identity 2025-07-24 11:28:29 +02:00
Daniel Schmidt
8649eae35d rename ActionInvocation for clarity 2025-07-08 16:24:38 +02:00
Daniel Schmidt
8c657163b2 add hooks for action invocation lifecycle 2025-07-08 16:24:38 +02:00
Radek Simko
bfa011e88b
command/views: Fix flaky hook tests (#36104) 2024-12-09 10:23:55 +00:00
Radek Simko
8176657c5b
command/views: Attempt to fix flaky JSON hook test (#35940) 2024-11-04 16:49:29 +00:00
Radek Simko
0a266c88c4
terraform: Emit lifecycle phases of ephemeral resources to the UI (#35919) 2024-10-30 12:44:02 +00:00
Liam Cervante
3ce9e517ae
fix flaky test in views package (#35469) 2024-07-17 13:10:11 +02:00
Nick Fagerlund
94ea534e40 Refactor terraform.Hook to use a resource-identifying wrapper struct
The terraform.Hook interface lets other areas of code perform streaming
reactions to various events, generally in the service of some UI somewhere.
Nearly all of the methods on this interface take an `addrs.AbsResourceInstance`
as their first argument, to identify the resource that's being operated on.

However, that addrs struct doesn't necessarily contain everything you might want
in order to uniquely and usefully identify a resource. It has the module
instance and resource instance addresses, but it lacks the provider source
address, which can affect how the consuming UI should display the resource's
events. (For example, Terraform Cloud wants reliable info about who maintains a
given provider, what cloud provider it operates on, and where to find its
documentation.)

Instead of polluting `addrs.AbsResourceInstance` with extra information that
isn't relevant to other call sites, let's change the first argument of each Hook
method to be a wrapper struct defined in the package that owns the Hook
interface, and add the provider address to that wrapper as a sibling of the
resource address. This causes a big noisy commit today, but should streamline
future updates to the UI-facing "identity" of a resource; existing callers can
ignore any new fields they're uninterested in, or exploit new info as needed.

Other than making new information available for future edits to Hook
implementing types, this commit should have no effect on existing behavior.
2024-02-27 19:28:20 -08:00
Martin Atkins
13e26b60dd addrs: Adopt DeposedKey as an address type; remove states.Generation
Previously we had states.DeposedKey as our representation of the unique
keys used to differentiate between multiple deposed objects on the same
resource instance. That type is useful in various places, but its presence
in the "states" package made it troublesome to import for some callers.

Since its purpose is as an identifier, this type is more at home in the
"addrs" package. The states package retains a small number of aliases to
preserve compatibility with a few existing callers for now, until we have
the stomach for a more invasive change.

This also removes the largely-redundant states.Generation interface type,
which initially was intended as a way to distinguish between "current"
objects and deposed objects, but didn't really add anything because we
already have addrs.NotDeposed to represent that situation. Instead, we
just ended up with various bits of boilerplate adapter code converting
between the two representations. Everything now uses addrs.DeposedKey and
uses addrs.NotDeposed to identify non-deposed objects.
2023-11-15 12:38:55 -08:00
hashicorp-copywrite[bot]
53c34ff49c
Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
hashicorp-copywrite[bot]
325d18262e [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
James Bardin
c52e3ed37b test fixture race 2022-04-20 15:01:17 -04:00
Martin Atkins
36d0a50427 Move terraform/ to internal/terraform/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Martin Atkins
f40800b3a4 Move states/ to internal/states/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Martin Atkins
034e944070 Move plans/ to internal/plans/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Martin Atkins
ffe056bacb Move command/ to internal/command/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Renamed from command/views/hook_json_test.go (Browse further)