Commit graph

116 commits

Author SHA1 Message Date
Radek Simko
0fe906fa8c make copyrightfix 2026-02-17 13:56:34 +00:00
Samsondeen
719aefdb89
tf query: ready list blocks for beta (#37619) 2025-09-17 12:29:04 +02:00
Kristin Laemmert
df113486a1
actions: remove references to action types, linked resources (#37616)
* action renaming
* actions: remove references to action types
* actions: remove references to linked_resources or action types from the plan proto
2025-09-16 08:46:22 -04:00
Daniel Schmidt
871451122f actions: move schema to single action type and remove linked resources
we want to leave the door open to evolve the design in the future based on feedback
2025-09-15 17:09:22 +02:00
Liam Cervante
ffdf9f2a86
actions: preserve unknown metadata in the json plan (#37611)
* actions: preserve unknown metadata in the json plan

* copywrite headers
2025-09-15 14:21:14 +02:00
Daniel Banck
1ac8497994
Add support for Terraform Search in the cloud backend (TF-25935) (#37479) 2025-09-15 13:21:05 +02:00
Daniel Schmidt
85717fba7e actions: add number of invoked actions to plan summary 2025-09-03 10:12:09 +02:00
Liam Cervante
673717d01a
actions: render invoked actions (#37540)
* actions: add invoke graph nodes

* fix small bugs

* add additional tests

* remove whitespace

* actions: invoke rendered actions

* also fix up apply message

* make description headers consistent

* fix copyright headers

* go generate
2025-09-01 09:01:48 +00:00
Liam Cervante
8488fbb35c
Revert "actions: render invoked actions (#37522)" (#37538)
This reverts commit 0fae555389.
2025-09-01 08:51:14 +00:00
Liam Cervante
0fae555389
actions: render invoked actions (#37522)
* actions: add invoke graph nodes

* fix small bugs

* add additional tests

* remove whitespace

* actions: invoke rendered actions

* also fix up apply message

* make description headers consistent

* fix copyright headers

* go generate
2025-08-29 12:52:12 +00:00
Daniel Schmidt
8b65426ecf move action schemas out of experimental flag 2025-08-28 12:04:51 +02:00
Daniel Banck
2463f864dd
Exclude nested config block from list resource schemas (#37495)
* Exclude nested config block from list resource schemas

* Guard action schemas by experimental flag

* Fix tests
2025-08-26 13:17:27 -04:00
Daniel Schmidt
871d3ce64f support sensitive values in action configuration 2025-08-25 15:00:34 +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
8a88bbbff3 use constants 2025-07-31 16:07:38 +02:00
Daniel Schmidt
4fb4c3f056 render action config values 2025-07-31 16:07:38 +02:00
Daniel Schmidt
dd86671056 marshal action schemas into json provider representation 2025-07-31 16:07:38 +02:00
Daniel Schmidt
eb26b72d55 display lifecycle triggered actions aside their triggering resources 2025-07-31 16:07:38 +02:00
Daniel Schmidt
7d8b79a596 add a simple first rendering of action invocations to be run 2025-07-31 16:07:38 +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 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
ab04e5cfec
Include list resource schemas in provider json schemas (TF-25497) (#37163)
* Include list schemas in provider json schemas

* Only include list schemas in experimental builds
2025-06-30 10:59:19 +02:00
Samsondeen
c0a7ff235b
Apply some new go collection features (#36818) 2025-04-02 16:20:16 +02:00
Daniel Schmidt
fec6e4b552 send resource identities to provider calls 2025-03-12 09:18:55 +01:00
Daniel Banck
10c9b64007
Rename schema.Block to Body (#36629) 2025-03-04 16:33:43 +01:00
Radek Simko
289a3568da
Address go vet 1.24 failures (#36485)
* address go vet failures

* avoid unnecessary .Error()
2025-02-12 16:51:53 +00:00
Daniel Schmidt
276662f754 ephemeral: add test case for block rendering 2025-01-07 10:19:51 +01:00
Liam Cervante
672cd816d5 don't precompute actions 2025-01-07 10:19:51 +01:00
Daniel Schmidt
0e6a3ac994 ephemeral: render write-only attributes in plan UI 2025-01-07 10:19:51 +01: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
332757894d
plan renderer: fix crash when updating a null attribute to unknown (#35709) 2024-09-11 14:27:36 +02:00
Liam Cervante
abd6b9ef1b
plan renderer: render unknown nested blocks properly (#35644) 2024-09-11 14:20:14 +02:00
kmoe
a2039517a5
states: store ephemeral output values in memory (#35676)
Ephemeral root output values must be kept in the in-memory state representation, but not written to the state file. To achieve this, we store ephemeral root outputs separately from non-ephemeral root outputs, so Terraform can access them during a single plan or apply phase.

Ephemeral root outputs always have a value of null in the state file. This means that the "terraform output" command, that reads the state file, reports null values for these outputs. Consumers of 'terraform output -json' should use the presence of '"ephemeral": true' in such output to interpret the value correctly.
2024-09-06 17:38:18 +01:00
James Bardin
16231373a4 update changes in command pkgs 2024-08-22 09:39:37 -04:00
Daniel Schmidt
3b95a5f6b1
fix formatting
Co-authored-by: Liam Cervante <liam.cervante@hashicorp.com>
2024-08-09 17:05:52 +02:00
Daniel Schmidt
8e1f02843d
jsonformat: update tests 2024-08-09 15:54:44 +02:00
Daniel Schmidt
b9933789aa
jsonformat: render deferred diff with no current changes message 2024-08-09 15:54:44 +02:00
Daniel Schmidt
c619cd2536
improve wording
Co-authored-by: Liam Cervante <liam.cervante@hashicorp.com>
2024-08-09 15:54:44 +02:00
Daniel Schmidt
a00e015e24
jsonformat: render different no changes message on deferred actions 2024-08-09 15:54:44 +02:00
Daniel Schmidt
4afb3b2b48
jsonformat: render deferred actions 2024-08-09 15:54:44 +02:00
James Bardin
6b19b9e82a render entirely unknown blocks in the plan output
The plan renderer was missing a check for entirely unknown blocks,
causing them to be omitted from the human readable output. An unknown
block can happen when using an unknown for_each value in a dynamic block
assignment.
2024-05-31 14:24:23 -04:00
Sebastian Rivera
015f795ff0 Rebrand Terraform Cloud to HCP Terraform 2024-04-23 16:12:59 -04:00
Martin Atkins
30e2fd6525 Handle marks a little more consistently
In the very first implementation of "sensitive values" we were
unfortunately not disciplined about separating the idea of "marked value"
from the idea of "sensitive value" (where the latter is a subset of the
former). The first implementation just assumed that any marking whatsoever
meant "sensitive".

We later improved that by adding the marks package and the marks.Sensitive
value to standardize on the representation of "sensitive value" as being
a value marked with _that specific mark_.

However, we did not perform a thorough review of all of the mark-handling
codepaths to make sure they all agreed on that definition. In particular,
the state and plan models were both designed as if they supported arbitrary
marks but then in practice marks other than marks.Sensitive would be
handled in various inconsistent ways: dropped entirely, or interpreted as
if marks.Sensitive, and possibly do so inconsistently when a value is
used only in memory vs. round-tripped through a wire/file format.

The goal of this commit is to resolve those oddities so that there are now
two possible situations:
 - General mark handling: some codepaths genuinely handle marks
   generically, by transporting them from input value to output value in
   a way consistent with how cty itself deals with marks. This is the
   ideal case because it means we can add new marks in future and assume
   these codepaths will handle them correctly without any further
   modifications.
 - Sensitive-only mark preservation: the codepaths that interact with our
   wire protocols and file formats typically have only specialized support
   for sensitive values in particular, and lack support for any other
   marks. Those codepaths are now subject to a new rule where they must
   return an error if asked to deal with any other mark, so that if we
   introduce new marks in future we'll be forced either to define how we'll
   avoid those markings reaching the file/wire formats or extend the
   file/wire formats to support the new marks.

Some new helper functions in package marks are intended to standardize how
we deal with the "sensitive values only" situations, in the hope that
this will make it easier to keep things consistent as the codebase evolves
in future.

In practice the modules runtime only ever uses marks.Sensitive as a mark
today, so all of these checks are effectively covering "should never
happen" cases. The only other mark Terraform uses is an implementation
detail of "terraform console" and does not interact with any of the
codepaths that only support sensitive values in particular.
2024-04-18 07:32:52 -07:00
Liam Cervante
924958bce0
plan renderer: ensure JSON strings are completely JSON (#34959) 2024-04-11 17:49:45 +02:00
James Bardin
bdd5a2cd33 try to render some empty string -> null changes
Changes between empty strings and `null` were hidden in the CLI output,
because the SDK could not reliably detect the difference and may return
either value depending on the situation.

This legacy behavior can be confusing for authors of new provider which
can correctly handle `null`, and it would be preferable to be able to
render those changes in the CLI.

While we don't have enough information to detect when the legacy
behavior is required, we can detect a number of cases where it's
certain that we are not dealing with a legacy schema and should output
the full diff.
2024-02-27 16:59:06 -05:00
Liam Cervante
82361afd73
plan rendering: fix truncation of very large numbers (#34702) 2024-02-20 09:48:11 +01:00
Daniel Schmidt
adf008d489
adjust tests to new implementation 2024-02-16 11:49:24 +01:00
Daniel Schmidt
19f9bdac14
handle multi-line string diffs correctly 2024-02-16 11:20:56 +01:00
Daniel Schmidt
a64df71152
fix comment 2024-02-16 11:20:56 +01:00
Daniel Schmidt
1531fee472
clarify comment 2024-02-16 11:20:56 +01:00