Commit Graph

30911 Commits

Author SHA1 Message Date
James Bardin
df601a7fd0
Merge pull request #32500 from hashicorp/jbardin/old-condition-results
remove deprecated `condition_results` from the json plan
2023-01-11 19:49:45 -05:00
James Bardin
96b1318167 remove deprecated condition_results from plan 2023-01-11 16:03:32 -05:00
James Bardin
0a73e216e5
Merge pull request #32463 from hashicorp/jbardin/nesting-single-null
NestingSingle blocks can be null
2023-01-11 11:00:16 -05:00
Liam Cervante
f6d625103c
Structured plan renderer: refactor replace paths logic (#32489)
* change -> diff, value -> change

* also update readme#

* structured plan renderer: refactor replace paths logic

* goimports

* goimports

* address comments

* fix compile error
2023-01-11 10:20:24 +01:00
Liam Cervante
38afb41787
Structured plan renderer: Introduce support for multiline and JSON strings (#32488)
* pause implementation

* change -> diff, value -> change

* add support for json and multiline strings to the primitive renderer

* goimports

* remove unused function

* go fmt

* address comments
2023-01-11 09:35:36 +01:00
Liam Cervante
8330b7295b
Structured plan renderer: Add support for map blocks and sensitive blocks. (#32491)
* change -> diff, value -> change

* also update readme#

* pause

* Update internal/command/jsonformat/computed/diff.go

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>

* add interface assertions for diff renderers

* Add support for different kinds of blocks, and for sensitive blocks

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2023-01-11 09:04:26 +01:00
Brian Flad
0b8c65fa4e
docs: Explicitly mention Computed-only attribute behavior for Proposed New State
Reference: 21bb677db7/internal/plans/objchange/objchange.go (L289-L292)

Previously, the resource lifecycle documentation for Proposed New State only mentioned special behavior for Optional and Computed attributes. This minor documentation update mentions that Terraform also imposes special behavior on Computed-only attributes (preserving any Prior State value).
2023-01-10 14:50:02 -05:00
Liam Cervante
21bb677db7
Structured Plan Renderer: Naming and package structure refactor (#32486)
* change -> diff, value -> change

* also update readme#

* Update internal/command/jsonformat/computed/diff.go

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>

* add interface assertions for diff renderers

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2023-01-10 17:24:48 +01:00
Liam Cervante
a086453783
Structured Plan Renderer: Refactor Primitive and Sensitive value processing (#32476)
* refactor sensitive and primitive values to match patterns used elsewhere

* goimports

* address comments

* fix tests

* also use %q for map keys
2023-01-09 20:38:25 +01:00
Liam Cervante
46ab53d651
Structured Plan Renderer: Escape object and block keys that don't match HCL syntax (#32483)
* Escape object and block keys that don't match HCL syntax

* address comments
2023-01-09 20:22:59 +01:00
Liam Cervante
7a3fc48b70
Structured Plan Renderer: Add tests validating behaviour of dynamic types (#32482)
* add support for dynamic types into attribute processing

* fix names

* add tests
2023-01-09 20:08:08 +01:00
Liam Cervante
d31631675b
Add support for Tuples into the structured plan renderer (#32479)
* add support for tuples to the structured plan renderer

* update after latest main changes
2023-01-09 17:39:13 +01:00
Liam Cervante
2d66eee872
Structured Plan Renderer: Address comments raised in previous PRs (#32478)
* Address comments raised in previous PRs

* add doc comments for public types
2023-01-09 17:15:17 +01:00
Liam Cervante
1332d315b6
Structured Plan Renderer: Remove generic interface{} entry point (#32477)
* Remove the single generic point of entry into the differ package

* goimports

* add comment explaining generic function
2023-01-09 16:49:35 +01:00
Liam Cervante
9bc5ded27a
Add support for outputs in the structured renderer (#32426)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer

* Add support for unknown/computed values in the structured renderer

* delete missing unit tests

* Add support for object attributes in the structured renderer

* goimports

* Add support for the replace paths data in the structured renderer

* Add support for maps in the structured renderer

* Add support for lists in the structured renderer

* goimports

* Add support for sets in the structured renderer

* goimports

* Add support for blocks in the structured renderer

* goimports

* Add support for outputs in the structured renderer

* fix ordering of blocks

* remove unused test stub

* fix typo
2023-01-09 14:45:35 +01:00
Liam Cervante
05f1764a0d
Add support for blocks in the structured renderer (#32422)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer

* Add support for unknown/computed values in the structured renderer

* delete missing unit tests

* Add support for object attributes in the structured renderer

* goimports

* Add support for the replace paths data in the structured renderer

* Add support for maps in the structured renderer

* Add support for lists in the structured renderer

* goimports

* Add support for sets in the structured renderer

* goimports

* Add support for blocks in the structured renderer

* goimports

* fix ordering of blocks

* remove unused test stub
2023-01-09 14:33:01 +01:00
Liam Cervante
69cce3597f
Add support for sets in the structured renderer (#32409)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer

* Add support for unknown/computed values in the structured renderer

* delete missing unit tests

* Add support for object attributes in the structured renderer

* goimports

* Add support for the replace paths data in the structured renderer

* Add support for maps in the structured renderer

* Add support for lists in the structured renderer

* goimports

* Add support for sets in the structured renderer

* goimports
2023-01-09 14:17:30 +01:00
Liam Cervante
aff94591c1
Add support for lists in the structured renderer (#32401)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer

* Add support for unknown/computed values in the structured renderer

* delete missing unit tests

* Add support for object attributes in the structured renderer

* goimports

* Add support for the replace paths data in the structured renderer

* Add support for maps in the structured renderer

* Add support for lists in the structured renderer

* goimports

* add additional comments explaining
2023-01-09 14:06:38 +01:00
Liam Cervante
8975eebf84
Add support for maps in the structured renderer (#32397)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer

* Add support for unknown/computed values in the structured renderer

* delete missing unit tests

* Add support for object attributes in the structured renderer

* goimports

* Add support for the replace paths data in the structured renderer

* Add support for maps in the structured renderer
2023-01-09 12:41:24 +01:00
Liam Cervante
b097d8873d
Add support for the replace paths data in the structured renderer (#32392)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer

* Add support for unknown/computed values in the structured renderer

* delete missing unit tests

* Add support for object attributes in the structured renderer

* goimports

* Add support for the replace paths data in the structured renderer
2023-01-09 12:27:36 +01:00
Liam Cervante
1eebcf875f
Add support for object attributes in the structured renderer (#32391)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer

* Add support for unknown/computed values in the structured renderer

* delete missing unit tests

* Add support for object attributes in the structured renderer

* goimports
2023-01-09 12:15:38 +01:00
Liam Cervante
b8b1a8d430
Add support for unknown/computed values in the structured renderer (#32378)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer

* Add support for unknown/computed values in the structured renderer

* delete missing unit tests
2023-01-09 11:55:55 +01:00
Liam Cervante
6ab277f6ba
Add support for sensitive values in the structured renderer (#32375)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer
2023-01-09 11:40:47 +01:00
Liam Cervante
71daef058f
Add rendering functionality for primitives to the structured renderer (#32373)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* goimports
2023-01-09 11:24:01 +01:00
Liam Cervante
aff7d360e1
Add skeleton functions and API for refactored renderer (#32368)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add README explaining implementation details for renderer and plans for future expansion

* Update internal/command/jsonformat/README.md

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>

* address comments

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2023-01-09 11:05:25 +01:00
Liam Cervante
b917154a97
Make required JSON structured output structures public for processing (#32367)
* prep for processing the structured run output

* undo unwanted change to a json key
2023-01-09 10:48:23 +01:00
kmoe
4fc02469e7
docs: delete outdated Resource Lifecycle page (#32387)
* Delete lifecycle.mdx

* remove resource lifecycle link

* Update internals-nav-data.json
2023-01-06 17:06:09 +00:00
James Bardin
e200f53ec0
Merge pull request #32464 from hashicorp/jbardin/output-check-refs
Ensure we have all references for output preconditions
2023-01-05 14:29:43 -05:00
James Bardin
45cb0489d0 test references only from output preconditions
These references were getting dropped, which could cause the referenced
nodes to be pruned from the graph.
2023-01-05 10:01:25 -05:00
James Bardin
1790f844b3 output refs missing error_message
Output references must also include the error_message expression.
Fix the early return in referencesForOutput, which could skip
preconditions. The small slice allocation optimization is not really
needed here, since this is not a hot path at all.
2023-01-05 09:59:52 -05:00
James Bardin
d5d6d61c4c NestingSingle blocks can be null
NestingSingle blocks removed from from the config were causing a plan to
error out with "... planned for existence but config wants absence".
Terraform core was proposing an incorrect value in this case, taking the
prior instead as a fallback because a null value was not expected.

Unlike other collection nesting modes, a NestingSingle block not present
in the configuration is a null value, and should be allowed when
planning a new value rather than building an empty object or falling
back to the prior value.
2023-01-05 09:07:50 -05:00
James Bardin
6e2a7496c4 update CHANGELOG.md 2023-01-04 12:47:38 -05:00
James Bardin
721df0e68d
Merge pull request #32395 from hashicorp/jbardin/plan-output-on-error
Always show and store planned actions and checks even when planning fails
2023-01-04 12:44:52 -05:00
Liam Cervante
8e1b660b79
Update equivalence tests to counter non-deterministic output (#32366) 2023-01-04 17:36:43 +01:00
James Bardin
5bcfd36c26
Merge pull request #32428 from hashicorp/jbardin/ignore-changes-panic
don't panic with a null list block value in config
2023-01-04 09:20:38 -05:00
Craig Wright
deea9b24a9
Merge pull request #32442 from Twixes/patch-1
Add missing HCL syntax highlighting in `composition.mdx`
2023-01-03 15:56:43 -08:00
Michael Matloka
28d7a685a9
Add missing HCL syntax highlighting in composition.mdx 2022-12-30 00:36:19 +01:00
James Bardin
ea193d5ce6 don't panic with a null list block value in config
Using ignore_changes with a list block, where the provider returned an
invalid null value for that block, can result in a panic when validating
the plan.

Future releases may prevent providers from storing a null block in
state, however we can avoid the panic for now. Only the NestingList case
needs to be handled, because legacy providers only have list and set
blocks, and the set case does not use the config value.
2022-12-21 15:01:03 -05:00
James Bardin
0e46d0ad25
Merge pull request #32424 from hashicorp/jbardin/reify-null-blocks
fix invalid null blocks during refresh
2022-12-21 13:17:41 -05:00
James Bardin
d493e998e1 add resource address to log message 2022-12-21 10:53:11 -05:00
James Bardin
a6098b67fa fix test state 2022-12-21 10:47:07 -05:00
James Bardin
0c1aaba635 fix invalid null blocks during refresh
Legacy providers may return null values for nested blocks during
refresh. Because the ReadResource call needs to accept any value to
allow the provider to report external changes, we allowed all changes to
the value as long as the underlying cty.Type was correct, allowing
null block values to be inserted into the state.

While technically invalid, we needed to accept these null values for
compatibility, and they were mostly seen as a nuisance, causing noise in
external changes and plan output. These null block values however can be
inserted into the effective configuration with the use of
`ignore_changes`, which can cause problems where the configuration is
assumed to be completely valid.

Rather than accept the null values, we can insert empty container values
for these blocks when refreshing the instance, which will prevent any
invalid values from entering state at all. Because these must still be
accepted for compatibility, we can only log the difference as a warning.
Currently the NormalizeObjectFromLegacySDK does not report which
specific blocks it fixed, so we just log a generic message.
2022-12-21 10:18:26 -05:00
Craig Wright
898b0aa78b
Merge pull request #32404 from stefansundin/add-missing-apt-repos
website: add missing Ubuntu apt repositories jammy and kinetic to the list
2022-12-19 17:15:27 -08:00
Stefan Sundin
a4a1f47027 Add missing Ubuntu apt repositories jammy and kinetic to the list. 2022-12-16 21:57:26 -08:00
James Bardin
49a0eb5ed8 update CHANGELOG.md 2022-12-16 15:32:33 -05:00
James Bardin
5605f20686 update CHANGELOG.md 2022-12-16 15:30:37 -05:00
James Bardin
25ac4d33e4
Merge pull request #31633 from brittandeyoung/f-workspace-selectornew
New Terraform Workspace select flag: `-or-create`
2022-12-16 15:29:25 -05:00
Brittan DeYoung
8881418c99
Update internal/command/workspace_select.go
Co-authored-by: James Bardin <j.bardin@gmail.com>
2022-12-16 15:03:46 -05:00
James Bardin
d60d247e40
Merge pull request #31318 from twittyc/twittyc/terraformWorkspaceInvalidArgsReturnsNon0
Bug fix: Terraform workspace command returns zero exit code when given an invalid argument.
2022-12-16 13:16:56 -05:00
James Bardin
3cda7a0269
Merge pull request #29520 from ComBin/main
Don't show symbols while input if variable marked as sensitive
2022-12-16 13:13:33 -05:00