Commit graph

25 commits

Author SHA1 Message Date
Sebastian Rivera
305dba5dcc feat: denote sensitive attribute paths in query start msg
This new field will be consumed in order to redact sensitive values referenced in a list block's input configuration from the query logs. We simply pipe the config schema and the marked values, and include the paths in the query_start log output.
2026-02-27 11:01:23 +01:00
Radek Simko
0fe906fa8c make copyrightfix 2026-02-17 13:56:34 +00:00
Samsondeen
7379832fb8
query: add identity_version to list_resource_found json output (#37612) 2025-09-15 17:10:02 +02:00
Samsondeen
3f7d043566
Append warning in CLI output when query result is empty (#37379) 2025-08-01 16:39:58 +02:00
Daniel Banck
c177897320
Improve list result output (#37344) 2025-07-23 16:52:37 +02:00
Kristin Laemmert
9256074c43
Actions in plan/changes (#37320)
* Add actions to the plans and change
* jsonplan - ignoring LinkedResources for now, those are not in the MVP
* pausing here: we'll work on the plan rendering later
2025-07-17 08:19:57 -04:00
Daniel Schmidt
8c657163b2 add hooks for action invocation lifecycle 2025-07-08 16:24:38 +02:00
Daniel Banck
2b9d25c7fd
Add terraform query subcommand (TF-25494) (#37174)
* WIP

* Reuse plan command for query CLI

* Basic CLI output

* Only fail a list request on error

* poc: store query results in separate field

* WIP: odd mixture between JSONs

* Fix list references

* Separate JSON rendering

The structured JSON now only logs a status on which list query is
currently running. The new jsonlist package can marshal the query fields
of a plan.

* Remove matcher

* Store results in an extra struct

* Structured list result logging

* Move list result output into hooks

* Add help text and additional flag

* Disable query runs with the cloud backend for now

* Review feedback
2025-07-02 15:06:25 +02:00
Daniel Banck
8213714929
Include identity in import apply UI output (#37044)
* Include identity in import apply UI output

* Add logging to hook ui errors
2025-05-16 15:24:24 +02:00
Daniel Banck
6917e69d12
Config-driven importing through identity (TF-23179) (#36703)
* configschema: Add identity attribute to import block

* Mark import target ID as legacy

* Add test with import identity

* Use ID or identity when importing via configuration

* Add plan import tests

* Review Feedback

* Make sure to copy identity for ResourceInstanceObjects

* Add helper for converting cty.Objects to string

* Replace getProvider calls

* Improve unknown object check
2025-04-02 13:39:16 +02:00
Guilherme Faria de Souza
d845df938d
Enhance elapsed time display in UI Hook with minutes and seconds (#36618)
* Feat: Enhance elapsed time display in UI hook with minutes and seconds format

* changelog: improve elapsed time display in UI Hook (#36368)

* update test output to use zero-padded elapsed time format
2025-03-05 10:40:57 +00:00
James Bardin
c2a1070c23 create a ui hook for unknown ephemeral config
This is a stopgap to give users some feedback when an ephemeral resource
contains unknowns and cannot be opened.

There is no json hook implementation so that the machine-readable spec
is not bound to the new output until further review. It doesn't really
fit with the current json ui model to have messages about what isn't
going to happen.
2024-11-06 13:56:20 -05:00
Radek Simko
0a266c88c4
terraform: Emit lifecycle phases of ephemeral resources to the UI (#35919) 2024-10-30 12:44:02 +00: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
CJ Horton
bc084858b1 add import hooks for plan and apply
Separate hooks used for the legacy import command for those used by
the new import mechanism; also add apply output for imports.
2023-05-10 20:53:44 -07:00
Liam Cervante
2793af042c Revert "Plannable import: Make the streamed logs more consistent during a plan operation (#33155)"
This reverts commit 3c20f7b340.
2023-05-10 11:00:45 +02:00
Liam Cervante
3c20f7b340
Plannable import: Make the streamed logs more consistent during a plan operation (#33155) 2023-05-10 08:27:15 +02:00
hashicorp-copywrite[bot]
325d18262e [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
Martin Atkins
72dd14ca5c core: Do everything except the actual action for plans.NoOp
Previously we tried to early-exit before doing anything at all for any
no-op changes, but that means we also skip some ancillary steps like
evaluating any preconditions/postconditions.

Now we'll skip only the main action itself for plans.NoOp, and still run
through all of the other side-steps.

Since one of those other steps is emitting events through the hooks
interface, this means that now no-op actions are visible to hooks, whereas
before we always filtered them out before calling. I therefore added some
additional logic to the hooks to filter them out at the UI layer instead;
the decision for whether or not to report that we visited a particular
object and found no action required seems defensible as a UI-level concern
anyway.
2022-07-22 15:27:15 -07: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_ui.go (Browse further)