Commit graph

71 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
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
Daniel Schmidt
75445e1ef8 use a string as deprecation origin to help with indirect references
We want to be able to give better information if e.g. the entire module is stored in a local and the deprecated value is only later used.

Where the diag is emitted we might only see the local and not the true origin of the deprecation

A string identifying the source of the deprecation should help
2026-02-03 16:04:43 +01:00
Daniel Schmidt
a96df66a9a display origin of deprecated value in diagnostic 2026-02-03 16:04:43 +01:00
Daniel Schmidt
ea7f1e3043 add extra origin information for deprecation diagnostics 2026-02-03 16:04:43 +01:00
Daniel Schmidt
2714cfde69 standardize on marks.Has
Some checks are pending
build / Build for windows_amd64 (push) Blocked by required conditions
build / Build for freebsd_arm (push) Blocked by required conditions
build / Build for linux_arm (push) Blocked by required conditions
build / Build for darwin_arm64 (push) Blocked by required conditions
build / Build for linux_arm64 (push) Blocked by required conditions
build / Build for windows_arm64 (push) Blocked by required conditions
build / Build Docker image for linux_386 (push) Blocked by required conditions
build / Build Docker image for linux_amd64 (push) Blocked by required conditions
build / Build Docker image for linux_arm (push) Blocked by required conditions
build / Build Docker image for linux_arm64 (push) Blocked by required conditions
build / Build e2etest for linux_386 (push) Blocked by required conditions
build / Build e2etest for windows_386 (push) Blocked by required conditions
build / Build e2etest for darwin_amd64 (push) Blocked by required conditions
build / Build e2etest for linux_amd64 (push) Blocked by required conditions
build / Build e2etest for windows_amd64 (push) Blocked by required conditions
build / Build e2etest for linux_arm (push) Blocked by required conditions
build / Build e2etest for darwin_arm64 (push) Blocked by required conditions
build / Build e2etest for linux_arm64 (push) Blocked by required conditions
build / Run e2e test for linux_386 (push) Blocked by required conditions
build / Run e2e test for windows_386 (push) Blocked by required conditions
build / Run e2e test for darwin_amd64 (push) Blocked by required conditions
build / Run e2e test for linux_amd64 (push) Blocked by required conditions
build / Run e2e test for windows_amd64 (push) Blocked by required conditions
build / Run e2e test for linux_arm (push) Blocked by required conditions
build / Run e2e test for linux_arm64 (push) Blocked by required conditions
build / Run terraform-exec test for linux amd64 (push) Blocked by required conditions
Quick Checks / Unit Tests (push) Waiting to run
Quick Checks / Race Tests (push) Waiting to run
Quick Checks / End-to-end Tests (push) Waiting to run
Quick Checks / Code Consistency Checks (push) Waiting to run
2025-10-09 14:48:13 +02:00
Samsondeen
7379832fb8
query: add identity_version to list_resource_found json output (#37612) 2025-09-15 17:10:02 +02:00
Samsondeen
8097374c3d
Fix panic when generating json config for tf query (#37596) 2025-09-12 14:46:48 +02:00
James Bardin
4c610ac5e6 use the new genconfig types throughout 2025-08-29 15:11:56 -04:00
James Bardin
ddc47f15e7 remove the recursive genconfig resource struct
The Resource struct didn't really match the data structure. Refactor
this to make it easier to break up the config generation calls so we can
pass in final config from the provider.
2025-08-29 15:11:56 -04: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
Daniel Schmidt
90bdc053f2 add SRO message for planned action invocation 2025-08-22 10:38:47 +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
3cf76a7d45 make wording more consistent 2025-08-13 16:47:28 +02:00
Daniel Schmidt
ecfbdaf18d add number of action invocations to change summary 2025-08-13 16:47:28 +02:00
Daniel Banck
dcb0486c44
Update query complete message to a struct (#37395) 2025-08-04 15:47:28 +02:00
Samsondeen
3f7d043566
Append warning in CLI output when query result is empty (#37379) 2025-08-01 16:39:58 +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
Samsondeen
8d8b2bb694
Generate config for list results (#37173) 2025-07-04 11:35:39 +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
Radek Simko
4e00e1ecdb
fix: Avoid crash on test failure in BinaryOpExpr in function call (#37071)
* fix: Avoid crash on test failure in BinaryOpExpr in function call

* add changelog entry
2025-05-16 10:49:31 +00:00
Samsondeen
1bd312f155
Produce detailed diagnostic objects when test run assertions fail (#36522) 2025-03-03 15:46:04 +01:00
Liam Cervante
a4e1e60a01
logging: add trace statements when changes are ignored (#36259)
* logging: add trace statements when changes are ignored

* copywrite headers
2025-01-03 11:28:19 +01:00
Daniel Schmidt
fa44937977
ephemeral: improve diagnostic message through compactValueStr 2024-11-04 15:35:22 +01:00
Radek Simko
0a266c88c4
terraform: Emit lifecycle phases of ephemeral resources to the UI (#35919) 2024-10-30 12:44:02 +00:00
Daniel Schmidt
b9f273639d
handle ephemeral and sensitive case in diagnostics 2024-10-16 17:24:11 +02:00
Daniel Schmidt
97ba67edea
test: ensure ephemeral values are not shown in diagnostics and warning is printed 2024-10-16 16:30:31 +02:00
Martin Atkins
6f84623cb6 terraform: Initial partial support for ephemeral values
This is a checkpoint commit on the path to supporting ephemeral values as
a cross-cutting concern in the Terraform language. An ephemeral value is
one that lives only in RAM during a single phase and so cannot persist
from the plan phase to the apply phase, or between consecutive plan/apply
rounds.

Terraform tracks whether each value is ephemeral using the cty "marks"
concept, thus achieving the same dynamic analysis as we already employ for
the concept of "sensitive values" that prevents displaying a value in the
user interface.

This commit is just a starting point which gets some of the basics into
place:
 - input variables and output values can both be statically declared as
   being ephemeral. Only ephemeral inputs/outputs can have ephemeral values
   assigned to them, and the recipient of the value sees it as ephemeral
   even if the assigned value was not already ephemeral.

   This creates a dynamic analysis cutoff point at module boundaries so
   that it's possible to determine in isolation whether a single module is
   using ephemeral values correctly, without having to test it in every
   possible calling context.
 - Managed and data resources cannot have ephemeral values assigned into
   their configurations because Terraform and providers both expect the
   resource attributes to persist between phases.
 - Ephemeral values _can_ be used in provider and provisioner
   configurations, because both of those effectively meet the definition
   of the new "ephemeral" concept despite it not previously having a name.
 - Ephemeral markings propagate through all of the built-in language
   features for dynamic analysis purposes, largely relying on cty's efforts
   to do that in similar vein as for sensitive marks. In particular,
   it's possible to define a local value whose expression produces
   an ephemeral result, and passing ephemeral values to functions should
   propagate the ephemeral mark to the results when appropriate. (I've not
   yet thoroughly reviewed all of the built-in functions for correct
   marks handling though, so there may be some gaps to address in later
   commits.)

The next step for this work will be to change the modules runtime to have
support for a workflow involving ephemeral _root_ input variables, where
their values must be re-supplied during the apply phase. That will then
achieve (in experimental capacity) the first goal of ephemeral values: to
be able to provide non-persistent settings such as time-limited API tokens
to use in provider configuration blocks.
2024-06-05 09:09:30 -07:00
Brandon Croft
3a5221269b
Revert "Add Warning for Deprecated Modules in Init (Second Revision)" 2024-05-30 16:01:39 -06:00
Mark DeCrane
1e7c29243e Added Extra field for TFC diagnostic processing 2024-05-22 18:06:00 -04:00
Sebastian Rivera
015f795ff0 Rebrand Terraform Cloud to HCP Terraform 2024-04-23 16:12:59 -04:00
kmoe
a718f70f85
Add removed block (#34251)
* terraform: remove redundant code

NodeDestroyResourceInstance is never instantiated with a DeposedKey of anything other than states.NotDeposed, so the deleted code is never run. Deposed objects get a NodeDestroyDeposedResourceInstanceObject instead.

* tfdiags: add helper func

* configs: introduce removed block type

* terraform: add forget action

* renderer: render forget actions

* terraform: deposed objects can be forgotten

Deposed objects encountered during planning spawn
NodePlanDeposedResourceInstanceObject, which previously generated a
destroy change. Now it will generate a forget change if the deposed
object is a forget target, and a destroy change otherwise.

The apply graph gains a new node type,
NodeForgetDeposedResourceInstanceObject, whose execution simply removes
the object from the state.

* configs: add RemoveTarget address type

* terraform: modules can be forgotten

* terraform: error if removed obj still in config

* tests: better error on restore state fail

* Update CHANGELOG.md
2023-11-29 11:58:28 +00:00
Liam Cervante
01c0480e77
Test framework will produce regular updates in -json mode (#33953)
* Test framework will produce regular updates in -json mode

* add tests

* docs

* docs tweaking
2023-10-02 09:14:20 +02:00
Liam Cervante
ffbcaf8bef
Implement TFC integration for private module registry test runs (#33710)
* implement module testing via TFC

* ready for review

* fix static checks

* licence headers
2023-09-14 09:01:25 +02:00
Liam Cervante
91d26b6ea6
Refactor file and run block feedback frequency (#33840)
* Refactor file and run block feedback frequency

* fix consistency checks

* make generate
2023-09-08 19:43:18 +02:00
CJ Horton
98b81d3c50 add missing copyright headers 2023-08-16 11:21:49 -07:00
hashicorp-copywrite[bot]
53c34ff49c
Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
Liam Cervante
6c7db16566
testing framework: refactor interrupt logic for immediate exits (#33532)
* testing framework: refactor interrupt logic

* fix formatting
2023-07-19 10:31:32 +02:00
Liam Cervante
6882dd9530
testing framework: introduce test command optional flags (#33504)
* testing framework: introduce test command optional flags

* address consistency checks
2023-07-19 10:07:46 +02:00
Liam Cervante
ed822559e5
[Testing framework] Implement JSON view functionality for test command (#33400) 2023-06-28 09:30:29 +02:00
Martin Atkins
696cd68913 command/views: Describe unknown collection bounds in diagnostics 2023-05-24 13:44:08 -07:00
CJ Horton
5d7864316e
Merge pull request #33160 from hashicorp/radditude/apply-counts
Populate import counts during applies and clean up output
2023-05-12 09:33:33 -07:00
Liam Cervante
4d837df546
Plannable import: Add generated config to JSON and human-readable plan output (#33154)
* command: keep our promises

* remove some nil config checks

Remove some of the safety checks that ensure plan nodes have config attached at the appropriate time.

* add GeneratedConfig to plan changes objects

Add a new GeneratedConfig field alongside Importing in plan changes.

* add config generation package

The genconfig package implements HCL config generation from provider state values.

Thanks to @mildwonkey whose implementation of terraform add is the basis for this package.

* generate config during plan

If a resource is being imported and does not already have config, attempt to generate that config during planning. The config is generated from the state as an HCL string, and then parsed back into an hcl.Body to attach to the plan graph node.

The generated config string is attached to the change emitted by the plan.

* complete config generation prototype, and add tests

* Plannable import: Add generated config to json and human-readable plan output

---------

Co-authored-by: Katy Moe <katy@katy.moe>
2023-05-11 08:50:03 +02: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
hashicorp-copywrite[bot]
bb36298b21 [COMPLIANCE] Add Copyright and License Headers 2023-05-08 15:47:42 -07:00