Commit Graph

686 Commits

Author SHA1 Message Date
RLRabinowitz
650caafafb Test: Refresh-only and refresh:false should fail validation
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2023-09-03 13:20:21 +03:00
RLRabinowitz
08536a74a2 Add test cases for opentf test - refresh-only, and making sure target actually runs a single target
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2023-09-03 13:20:21 +03:00
Elbaz
c930676fe7
Merge pull request #219 from opentffoundation/update-github-and-release 2023-08-29 14:56:25 +03:00
Elbaz
b08614ef11
Merge pull request #215 from opentffoundation/another-test-to-make-sure-runtime-checks-are-fine-with-test 2023-08-29 14:55:48 +03:00
Elbaz
034ae97bdf update githbu 2023-08-29 13:00:09 +03:00
Elbaz
abf03204d8 expect_runtime_check_pass_command_plan_expected 2023-08-29 12:20:34 +03:00
Elbaz
4988185c58 fix test 2023-08-29 11:47:11 +03:00
Elbaz
a444b7e6f2 expect_runtime_check_fail_command_plan 2023-08-29 11:17:42 +03:00
Elbaz
94400dfebb expect_runtime_check_pass_with_expect 2023-08-29 11:02:42 +03:00
RLRabinowitz
e23eea6d82
Merge pull request #211 from opentffoundation/remote-terraform-from-tests
Remove `terraform` from test files and directories
2023-08-29 10:45:43 +03:00
Elbaz
a330254be2 another case 2023-08-29 10:19:26 +03:00
RLRabinowitz
23cd2c91c1 Remove terraform from E2E test names 2023-08-28 17:29:07 +03:00
RLRabinowitz
a0af99fe99 Remove terraform test file names in internal/command tests 2023-08-28 17:22:36 +03:00
RLRabinowitz
3dd8fc9943 Remove terraform mention from TF file names 2023-08-28 17:10:28 +03:00
Elbaz
67294dd643
Merge pull request #207 from opentffoundation/add-broken-tf-test-hcl-files 2023-08-28 16:44:56 +03:00
Elbaz
c38b6cd46b fix expected 2023-08-28 16:23:03 +03:00
Elbaz
cf04e25f79 more cases 2023-08-28 16:21:40 +03:00
Elbaz
02c0c44bdd add data test case 2023-08-28 16:11:22 +03:00
Elbaz
5c9a332ad6 added use cases 2023-08-28 16:02:16 +03:00
RLRabinowitz
1b36b9262a
Merge pull request #200 from opentffoundation/internal-opentf
Change `internal/terraform` to `internal/opentf`
2023-08-28 15:48:46 +03:00
Elbaz
aea45de290 adding test cases 2023-08-28 15:00:33 +03:00
Marcin Wyszynski
b36ff25ea7
No special treatment for Hashi signatures (#185) 2023-08-28 13:41:25 +02:00
RLRabinowitz
90dce4dd3c go fmt, change import order 2023-08-28 14:22:54 +03:00
RLRabinowitz
42e7c5b25c Replace internal/terraform -> internal/opentf 2023-08-28 14:21:34 +03:00
RLRabinowitz
7cabaf7de9
Merge pull request #198 from opentffoundation/internal-legacy-opentf
Rename `internal/legacy/terraform` to `internal/legacy/opentf`
2023-08-28 14:20:59 +03:00
RLRabinowitz
8a6987e3ff
Merge pull request #196 from opentffoundation/internal-builtin-providers-tf
Rename `internal/builtin/providers/terraform` and remove `provider-terraform`
2023-08-28 14:20:44 +03:00
RLRabinowitz
26d04f7ade
Merge pull request #190 from opentffoundation/chore-rename-terraform-test
Rename source code files that have "terraform" in them (not-including `website` or folders)
2023-08-28 14:19:56 +03:00
Elbaz
4cfd023dc9
Merge pull request #186 from opentffoundation/chore-change-user-agent 2023-08-28 12:03:10 +03:00
Elbaz
9362df1d9e rename func 2023-08-27 17:38:54 +03:00
RLRabinowitz
19239936a4 Rename internal/legacy/terraform to internal/legacy/opentf 2023-08-27 15:58:38 +03:00
RLRabinowitz
c6ff52a4a9 Rename internal/builtin/providers/terraform to internal/builtin/providers/tf 2023-08-27 15:40:02 +03:00
RLRabinowitz
a2f1215126 Removed unused code checking if version is outdated 2023-08-27 15:11:47 +03:00
RLRabinowitz
e8de2d7405 Re-add www.terraform.io references in test files 2023-08-27 15:11:47 +03:00
RLRabinowitz
cf1640bc10 Change terraform doc website links to be a placeholder for now 2023-08-27 15:11:45 +03:00
RLRabinowitz
30b121f9fe Rename terraform_test file 2023-08-27 13:27:02 +03:00
Marcin Białoń
90f23d19b6
Update user-facing references to Terraform internal/command/e2etest (#91)
Signed-off-by: Marcin Białoń <mbialon@spacelift.io>
2023-08-24 11:14:34 +02:00
Kuba Martin
3b5b8ba719
Update internal/command to use OpenTF in user-provided strings. (#87)
* Update `internal/command` to use OpenTF

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix e2e tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix e2e tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Rewrite message.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

---------

Signed-off-by: Jakub Martin <kubam@spacelift.io>
2023-08-24 10:56:05 +02:00
Marcin Wyszynski
68e0b50085
Remove user-facing mentions of Hashi TFE/TFC (#154) 2023-08-23 18:04:21 +02:00
Marcin Wyszynski
a92455198a
Remove checkpoint code - less is more (#151) 2023-08-23 16:42:50 +02:00
Marcin Białoń
34b3043be4
Update user-facing references to Terraform in internal/command/views (#88)
* Update `internal/command/views`

Signed-off-by: Marcin Białoń <mbialon@spacelift.io>

* fix tests

Signed-off-by: Marcin Białoń <mbialon@spacelift.io>

* Fix some tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix some tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* update tests golden files

Signed-off-by: Marcin Białoń <mbialon@spacelift.io>

* Fix tests

Signed-off-by: Marcin Białoń <mbialon@spacelift.io>

* Fix tests

Signed-off-by: Marcin Białoń <mbialon@spacelift.io>

* Fix tests

Signed-off-by: Marcin Białoń <mbialon@spacelift.io>

---------

Signed-off-by: Marcin Białoń <mbialon@spacelift.io>
Signed-off-by: Jakub Martin <kubam@spacelift.io>
Co-authored-by: Jakub Martin <kubam@spacelift.io>
2023-08-23 14:49:37 +02:00
Elbaz
0774b3d4d1
Merge pull request #135 from opentffoundation/update-internal-terraform 2023-08-23 15:47:04 +03:00
Elbaz
a782b8eb38 fix tests 2023-08-23 15:25:05 +03:00
RLRabinowitz
06e4c01f0e
Merge pull request #81 from opentffoundation/opentf-user-facing-internal-depsfile
Adapt user-facing usages of terraform in `internal/depsfile`
2023-08-23 13:56:17 +03:00
RLRabinowitz
9bc0b077b8
Merge pull request #85 from opentffoundation/opentf-user-facing-internal-genconfig
Adapt user-facing usages of terraform in `internal/genconfig`
2023-08-23 13:56:08 +03:00
Marcin Wyszynski
a9a78c000d
Adapt user-facing usages of terraform in internal/providercache (#119) 2023-08-23 12:24:02 +02:00
Elbaz
5e83430db2 fix init test 2023-08-23 11:56:26 +03:00
RLRabinowitz
d3ec25308f Fix tests in internal/command and internal/cloud, relying on the generated text 2023-08-23 10:22:32 +03:00
RLRabinowitz
6a2496a075 Fix provider lock tests that rely on the generated text + change some comments 2023-08-23 10:15:49 +03:00
RLRabinowitz
e6007a770f Fix tests in internal/command, relying on the generated text 2023-08-23 10:11:26 +03:00
Elbaz
36b43c7c28
Merge pull request #71 from opentffoundation/update-json-format 2023-08-22 19:24:50 +03:00
Kuba Martin
72fd4f9ce9
Update internal/command/clistate to use OpenTF in user-provided strings. (#72)
Signed-off-by: Jakub Martin <kubam@spacelift.io>
2023-08-22 16:51:22 +02:00
Elbaz
3dd3381ca4 update 2023-08-22 17:34:37 +03:00
Kuba Martin
6f4ab78a51
Update internal/command/cliconfig to use OpenTF in user-provided strings. (#65)
Signed-off-by: Jakub Martin <kubam@spacelift.io>
2023-08-22 16:32:49 +02:00
Kuba Martin
1312ca390f
Update internal/command/arguments to use OpenTF in user-provided strings. (#60)
Signed-off-by: Jakub Martin <kubam@spacelift.io>
2023-08-22 16:02:30 +02:00
Yaron Yarimi
67e9d1f2e4 Merge branch 'main' of github.com:opentffoundation/opentf into chore-rename-terraform-to-opentf-in-docs 2023-08-22 16:22:24 +03:00
Yaron Yarimi
24beb7ee5c Renaming terraform to opentf 2023-08-22 15:45:05 +03:00
Elbaz
19fbfe54a5 Merge branch 'main' into update-internal-bakcend-user-facing 2023-08-22 12:26:05 +03:00
Elbaz
535cf9d428 fix e2e 2023-08-22 12:17:53 +03:00
Elbaz
af8f424985 fix more tests 2023-08-22 12:03:38 +03:00
Elbaz
612238fe38 fix more tests 2023-08-22 11:59:26 +03:00
Elbaz
141e72246d fix tests + english 2023-08-21 19:33:20 +03:00
Kuba Martin
0ec2b6b150
Revert "Add support for ~/.opentf.d (#22)" (#38)
This reverts commit e650bab8d7.
2023-08-21 17:12:19 +02:00
Kuba Martin
e650bab8d7
Add support for ~/.opentf.d (#22)
* Use ~/.opentf.d instead of ~/.terraform.d

Stay backwards-compatible, though.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix imports.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Add tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Use util function.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix windows directories.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Add a comment to the tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

---------

Signed-off-by: Jakub Martin <kubam@spacelift.io>
2023-08-21 12:38:11 +02:00
Yaron Yarimi
e55369b364 Change all references from .terraformrc to .opentfrc 2023-08-20 18:50:30 +03:00
Yaron Yarimi
e9198b1d24 Change config file getter to treat .opentf.rc files 2023-08-20 18:42:12 +03:00
Yaron Yarimi
a0c351fc35 Add new or legacy path util 2023-08-20 18:41:15 +03:00
Kuba Martin
5bb46d0f65
Fix GitHub actions (#5)
* Change PKG_NAME

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix rpm and deb packaging.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix e2e test step.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix e2e test step.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix e2e test step.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix docker build.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix exec tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix e2e tests.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix docker build.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

---------

Signed-off-by: Jakub Martin <kubam@spacelift.io>
2023-08-17 16:42:24 +02:00
Kuba Martin
ebcf7455eb
Rename root module name. (#4)
* Rename module name from "github.com/hashicorp/terraform" to "github.com/placeholderplaceholderplaceholder/opentf".

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Gofmt.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Regenerate protobuf.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix comments.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Undo issue and pull request link changes.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Undo comment changes.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix comment.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Undo some link changes.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* make generate && make protobuf

Signed-off-by: Jakub Martin <kubam@spacelift.io>

---------

Signed-off-by: Jakub Martin <kubam@spacelift.io>
2023-08-17 14:45:11 +02:00
Liam Cervante
126f34e4e8 Implement updates to testing framework based on recent feedback 2023-08-10 10:49:01 +02:00
Liam Cervante
3cce200d0e Fix root cause of race condition in testing framework tests 2023-08-09 16:47:59 +02:00
Liam Cervante
f1ca74f09f Update JSON_UI_VERSION after test framework changes 2023-08-09 16:47:27 +02:00
Liam Cervante
f8b1fe47dd
Make config errors more important during init operations (#33628)
* make config errors more important during init operations

* address comments
2023-08-09 11:19:00 +02:00
James Bardin
e26d07dda4
Merge pull request #33634 from hashicorp/jbardin/init-from-module-warnings
Allow `get` and `init -from-module` to complete when there are configuration validation errors
2023-08-08 12:40:57 -04:00
James Bardin
ea1144995f update callers of InstallModules
Update callers of InstallModules and have `get` return only install
errors.
2023-08-07 15:22:02 -04:00
kmoe
765c25d2ed
allow interpolation in import block id (#33618)
The import block id field can now reference variables, attributes, and module outputs, as long as the result is a known non-empty string at plan time. A null or unknown value will result in an error.

This commit slightly modifies the legacy CLI terraform import code path to construct a synthetic hcl.Expression from the import id passed in from the command line, with no intended change of functionality.
2023-08-02 10:20:27 +01:00
Liam Cervante
8b764f2e1b
fix race condition in no_provides_in_main test (#33616) 2023-08-02 11:02:26 +02:00
Liam Cervante
3bea1171af
test framework: expand variables available to test assertions (#33611) 2023-08-01 09:59:29 +02:00
Liam Cervante
4560a83721
test framework: include transformed config before validating config (#33608) 2023-08-01 09:47:00 +02:00
Liam Cervante
f397954c52
testing framework: allow users to specify deeply nested testing directories (#33584) 2023-07-27 10:38:21 +02:00
Liam Cervante
4122ba86fc
terraform test: fix crash when using nested modules from test run blocks (#33589) 2023-07-27 10:22:53 +02:00
Liam Cervante
e1019b3641
testing framework: validate the configuration before terraform test (#33559)
* testing framework: call validate on the configuration before running terraform test

* address comments

* make tests pass after merge

* fix tests
2023-07-26 10:56:44 +02:00
Liam Cervante
55792309eb
test framework: add support for testing files to fmt command (#33576) 2023-07-26 10:38:47 +02:00
Liam Cervante
080ddead6e
testing framework: perform a plan before starting any tests (#33561) 2023-07-26 10:24:25 +02:00
Liam Cervante
083c9afd5b
testing framework: add trace and debug statements during test executions (#33554) 2023-07-26 10:11:27 +02:00
Brandon Croft
e5ce25099c
Apply suggestions from code review
Co-authored-by: Sebastian Rivera <sebastian.rivera@hashicorp.com>
2023-07-25 09:28:32 -06:00
Brandon Croft
9bb566dcdb
Update cloudplugin type casting to simplify adding future versions 2023-07-25 09:28:32 -06:00
Brandon Croft
2c3d134705
Adds cloud subcommand with some toy options 2023-07-25 09:28:32 -06:00
Brandon Croft
fec1ca69ac
Fix console godoc 2023-07-25 09:28:30 -06:00
Sebastian Rivera
08e58fd484 Fix saved plan test regressions, fixtures 2023-07-25 10:22:46 -04:00
Nick Fagerlund
1cbc95ce56 Use wrapped types to clean up error reporting in show command
Since terraform show can accept three different kinds of file to act on, its
error messages were starting to become untidy and unhelpful. The main issue was
that if we successfully identified the file type but then ran into some problem
while reading or processing it, the "real" error would be obscured by some other
useless errors (since a file of one type is necessarily invalid as the other
types).

This commit tries to winnow it down to just one best error message, in the
"happy path" case where we know what we're dealing with but hit a snag. (If we
still have no idea, then we fall back to dumping everything.)
2023-07-24 14:12:44 -04:00
Nick Fagerlund
ed27fa096e command/views/show_test: Update method arguments, add test cases 2023-07-24 14:12:44 -04:00
Nick Fagerlund
12af8518ff command/show_test: Update expected error text 2023-07-24 14:12:44 -04:00
Nick Fagerlund
3a9ce2afb1 Update show command and view to support inspecting cloud plans
One funny bit: We need to know the ViewType at the point where we ask the Cloud
backend for the plan JSON, because we need to switch between two distinctly
different formats for human show vs. `show -json`. I chose to pass that by
stashing it on the command struct; passing it as an argument would also work,
but one, the argument lists in these nested method calls were getting a little
unwieldy, and two, many of these functions had to be receiver methods anyway in
order to call methods on Meta.
2023-07-24 14:12:44 -04:00
Nick Fagerlund
0df3c143bb New plans.Quality type for display-relevant facts about a plan
This commit replaces the existing jsonformat.PlanRendererOpt type with a new
type with identical semantics, located in the plans package.

We needed to be able to exchange the facts represented by
`jsonformat.PlanRendererOpt` across some package boundaries, but the jsonformat
package is implicated in too many dependency chains to be safe for that purpose!
So, we had to make a new one. The plans package seems safe to import from all
the places that must emit or accept this info, and already contains plans.Mode,
which is effectively a sibling of this type.
2023-07-24 14:12:44 -04:00
Nick Fagerlund
f9d937a4dd Apply a confirmable run when given a saved cloud plan (#33270)
It displays a run header with link to web UI, like starting a new plan does, then confirms the run
and streams the apply logs. If you can't apply the run (it's from a different workspace, is in an
unconfirmable state, etc. etc.), it displays an error instead.

Notable points along the way:

* Implement `WrappedPlanFile` sum type, and update planfile consumers to use it instead of a plain `planfile.Reader`.

* Enable applying a saved cloud plan

* Update TFC mocks — add org name to workspace, and minimal support for includes on MockRuns.ReadWithOptions.
2023-07-24 14:12:40 -04:00
Brandon Croft
c1a730314d
Relocate localterraform.com aliasing to backend configurators
Previously, remote and cloud backends would automatically alias localterraform.com as the configured hostname during configuration. This turned out to be an issue with how backends could potentially be used within the builtin terraform_remote_state data source. Those data sources each configure the same service discovery with different targets for localterraform.com, and do so simultaneously, creating an occasional concurrent map read & write panic when multiple data sources are defined.

localterraform.com is obviously not useful for every backend configuration. Therefore, I relocated the alias configuration to the callers, so they may specify when to use it. The modified design adds a new method to backend.Enhanced to allow configurators to ask which aliases should be defined.
2023-07-21 09:55:41 -06:00
Liam Cervante
ad26644578
Fix flaky test in views package (#33560) 2023-07-20 18:57:35 +02:00
Liam Cervante
c91f91cc9e
testing framework: change test file extension to .tftest.hcl (#33553) 2023-07-20 16:57:05 +02:00
Liam Cervante
ca85d3bf85
Implement word wrapping in the terraform test view functions (#33547)
* Implement word wrapping in the terraform test view functions

* Update internal/command/views/test.go

Co-authored-by: CJ Horton <17039873+radditude@users.noreply.github.com>

---------

Co-authored-by: CJ Horton <17039873+radditude@users.noreply.github.com>
2023-07-20 08:29:09 +02: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
2cc81cfec6
testing framework: implement panic handling (#33525) 2023-07-19 09:57:09 +02:00
Liam Cervante
837716a703
testing framework: finalise expect_failures functionality (#33506) 2023-07-19 09:44:40 +02:00
Martin Atkins
7bee77bdd3 command: Start of propagating OpenTelemetry context
Several times over the years we've considered adding tracing
instrumentation to Terraform, since even when running in isolation as a
CLI program it has a "distributed system-like" structure, with lots of
concurrent internal work and also some work delegated to provider plugins
that are essentially temporarily-running microservices.

However, it's always felt a bit overwhelming to do it because much of
Terraform predates the Go context.Context idiom and so it's tough to get
a clean chain of context.Context values all the way down the stack without
disturbing a lot of existing APIs.

This commit aims to just get that process started by establishing how a
context can propagate from "package main" into the command package,
focusing initially on "terraform init" and some other commands that share
some underlying functions with that command.

OpenTelemetry has emerged as a de-facto industry standard and so this uses
its API directly, without any attempt to hide it behind an abstraction.
The OpenTelemetry API is itself already an adapter layer, so we should be
able to swap in any backend that uses comparable concepts. For now we just
discard the tracing reports by default, and allow users to opt in to
delivering traces over OTLP by setting an environment variable when
running Terraform (the environment variable was established in an earlier
commit, so this commit builds on that.)

When tracing collection is enabled, every Terraform CLI run will generate
at least one overall span representing the command that was run. Some
commands might also create child spans, but most currently do not.
2023-07-14 10:24:10 -07:00
Craig Wright
8f5064e6b4
Merge pull request #33433 from chaosaffe/fix-getcommand-helptext 2023-07-14 10:12:10 -07:00
Liam Cervante
87ed762619
Make flaky 'TestTest_DoubleInterrupt' test more robust (#33503) 2023-07-11 10:35:26 +01:00
Liam Cervante
4862812c94
testing framework: introduce interrupts for stopping tests (#33477)
* [testing framework] prepare for beta phase of development

* [Testing Framework] Add module block to test run blocks

* [testing framework] allow tests to define and override providers

* testing framework: introduce interrupts for stopping tests

* remove panic handling, will do it properly later
2023-07-10 14:53:13 +01:00
Liam Cervante
4b34902fab
[testing framework] allow tests to define and override providers (#33466)
* [testing framework] prepare for beta phase of development

* [Testing Framework] Add module block to test run blocks

* [testing framework] allow tests to define and override providers
2023-07-10 14:33:15 +01:00
Liam Cervante
5acc95dda7
[Testing Framework] Add module block to test run blocks (#33456)
* [testing framework] prepare for beta phase of development

* [Testing Framework] Add module block to test run blocks
2023-07-10 11:42:05 +01:00
Liam Cervante
c9bc7e8479
Add input validation into the 'checks' outputs and tracking (#33481) 2023-07-10 11:33:45 +01:00
CJ Horton
2622e89cfb
Merge pull request #33448 from agustinguayama/fix/small_typo
fix typo in terraform/internal/command /init.go
2023-07-07 09:45:44 -07:00
James Bardin
6be6f69d61
Merge pull request #33482 from hashicorp/jbardin/schema-cache
Refactor providers.Schemas and add a global schema cache
2023-07-06 16:06:32 -04:00
kmoe
d1a5dfa1ad
command: test plan -refresh= arg ordering (#33483)
* main: disambiguate arg ordering test

Make it extra clear what order of args we are asserting.

* command: fix plan -refresh=false test

The test for plan -refresh=false was not functioning, since ReadResource will not be called if the resource is not in prior state.

Add a new fixture directory with state, and also test the converse, to prevent regression.

* command: add test for refresh flag precedence

A consumer relies on the fact that running terraform plan -refresh=false -refresh true gives the same result as terraform plan -refresh=true.
2023-07-06 19:28:09 +01:00
James Bardin
cf5ebaf685 s/Schemas/ProviderSchema/ 2023-07-06 10:37:35 -04:00
James Bardin
36d34135ad replace remaining types in tests 2023-07-06 10:37:35 -04:00
James Bardin
d487ce20e1 update jsonprovider to use new schema type 2023-07-06 10:37:35 -04:00
James Bardin
53901a7e62 Add basic global schema cache
Add a single global schema cache for providers. This allows multiple
provider instances to share a single copy of the schema, and prevents
loading the schema multiple times for a given provider type during a
single command.

This does not currently work with some provider releases, which are
using GetProviderSchema to trigger certain initializations. A new server
capability will be introduced to trigger reloading their schemas, but
not store duplicate results.
2023-07-06 10:37:35 -04:00
Liam Cervante
ea162f6ab5
[testing framework] prepare for beta phase of development (#33445) 2023-07-06 15:53:18 +02:00
Liam Cervante
3613e972c5
Plan renderer: Support users indexing integer paths with stringified numbers (#33475) 2023-07-05 11:11:02 +02:00
Agustin Guayama
db5b81d2c1
fix typo in terraform/internal/command /init.go 2023-06-29 17:34:34 -03:00
Liam Cervante
2eb99a0e44
Fix the Terraform build after recent merges (#33436) 2023-06-28 10:12:43 +02:00
Liam Cervante
212ae6c4ba
Introduce separate testing scope for reference validation (#33339) 2023-06-28 09:47:24 +02:00
Liam Cervante
dfc26c2ac4
[Testing Framework] Add test command to Terraform CLI (#33327)
* Add test structure to views package for rendering test output

* Add test file HCL configuration and parser functionality

* Adds a TestContext structure for evaluating assertions against the state and plan

* Add test command to Terraform CLI
2023-06-28 09:37:42 +02:00
Liam Cervante
ed822559e5
[Testing framework] Implement JSON view functionality for test command (#33400) 2023-06-28 09:30:29 +02:00
kmoe
fbff64ad45
configs: remove import block duplicate id check (#33434) 2023-06-27 19:25:36 +01:00
Jason Murray
79669df479
Remove PATH from GetCommand helpText 2023-06-26 13:42:22 -07:00
Andrew Hickman
49f99db1c2
terraform show -json: Add Errored field to output for plan (#33372)
* Add Errored field to JSON output

* Fix test error message
2023-06-19 11:16:41 +01:00
Liam Cervante
ce8fd2943d
[Testing Framework] Add test structure to views package for rendering test output (#33324)
* Add test structure to views package for rendering test output

* address comments
2023-06-13 10:09:20 +02:00
Liam Cervante
48c818927c Remove old implementation of terraform test command 2023-06-12 11:17:42 +02:00
Katy Moe
7ce5503c7a views: fix wordwrap 2023-06-05 14:53:37 +02:00
kmoe
5900d1177c
cloud: assert import block compatibility (#33282)
* cloud: assert import block compatibility

* check for import <> TFC compatibility during init

* imports are not in alphabetical order 🙃

---------

Co-authored-by: CJ Horton <cjhorton@hashicorp.com>
2023-05-31 20:55:35 +01:00
kmoe
4386a15684
command: help text for generate-config-out (#33279) 2023-05-31 20:42:41 +01:00
Martin Atkins
696cd68913 command/views: Describe unknown collection bounds in diagnostics 2023-05-24 13:44:08 -07:00
kmoe
be2ad69eda
plannable import: safer config generation and schema filters (#33232)
* genconfig: fix nil nested block panic

* genconfig: null NestingSingle blocks should be absent

A NestingSingle block that is null in state should be completely absent from config.

* configschema: make FilterOr variadic

* configschema: apply filters to nested types

* configschema: filter helper/schema id attribute

The legacy SDK adds an Optional+Computed "id" attribute to the
resource schema even if not defined in provider code.
During validation, however, the presence of an extraneous "id"
attribute in config will cause an error.
Remove this attribute so we do not generate an "id" attribute
where there is a risk that it is not in the real resource schema.

* configschema: filter test

* terraform: do not pre-validate generated config

Config generated from a resource's import state may fail validation in
the case of schema behaviours such as ExactlyOneOf and ConflictsWith.
We don't want to fail the plan now, because that would give the user no
way to proceed and fix the config to make it valid. We allow the plan to
complete and output the generated config.

* generate config alongside import process

Rather than waiting until we call `plan()`, generate the configuration
at the point of the import call, so we have the necessary data to return
in case planning fails later.

The `plan` and `state` predeclared variables in the plan() method were
obfuscating the actual return of nil throughout, so those identifiers
were removed for clarity.

* move generateHCLStringAttributes closer to caller

* store generated config in plan on error

* test for config gen with error

* add simple warning when generating config

---------

Co-authored-by: James Bardin <j.bardin@gmail.com>
2023-05-24 11:16:05 +01:00
kmoe
b4d1146f58
plannable import: improve gen config human plan output (#33194)
* renderer: remove hard-coded config gen path

* mention config gen file in plan next steps
2023-05-15 15:21:41 +01:00
CJ Horton
bd6ba6cf99
check for duplicate import blocks (#33190)
Importing to the same target address twice or importing the same ID
to multiple different resources of the same type is not allowed.
2023-05-12 23:14:44 +01:00
Liam Cervante
d5fed58fc5
plannable import: write generated config to out flag (#33186)
* plannable import: write generated config to out flag

* Add example command to diagnostic
2023-05-12 23:05:00 +01: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
192cb255a6
checks: no longer experimental (#33184) 2023-05-11 20:17:49 +02: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
Liam Cervante
79f7f59155
Plannable import: Generate config for imported resources during the plan. (#33153)
* 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

---------

Co-authored-by: Katy Moe <katy@katy.moe>
2023-05-11 08:38:37 +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
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]
bb36298b21 [COMPLIANCE] Add Copyright and License Headers 2023-05-08 15:47:42 -07:00
Liam Cervante
77f10c4f68
Imports should come before Adds in change summaries (#33147) 2023-05-04 15:06:48 +02:00
Liam Cervante
81eb73731d
[Plannable Import] Implement streamed logs for plan (#33106)
* [plannable import] embed the resource id within the changes

* [Plannable Import] Implement streamed logs for -json plan

* use latest structs

* remove implementation plans from TODO
2023-05-04 10:02:06 +02:00
Liam Cervante
54c1c1162f
[Plannable Import] Implement human-readable plan rendering (#33113)
* [plannable import] embed the resource id within the changes

* add the plannable imports to the json and human plans

* latest importing struct
2023-05-03 18:50:04 +02:00
hashicorp-copywrite[bot]
325d18262e [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
Liam Cervante
b5576159da
Migrate 'state show' command to new renderer (#33116)
* Migrate 'state show' command to new renderer

* handle error
2023-05-02 15:27:59 +02:00
Lauren
50c3f53595 add resource_drift logtype 2023-04-24 15:08:33 -04:00
Liam Cervante
b54668f44c
make the unknown attribute renderer consider the force replacement metadata (#33065) 2023-04-24 11:02:32 +02:00
Liam Cervante
14123e277c
Include sensitive metadata from the schema when building the json state output (#33059)
* include sensitive metadata from the schema when building the json state output

* found another test case
2023-04-24 10:52:44 +02:00
Liam Cervante
519a18aedf
Propagate unknown and sensitive metadata to dynamic attributes (#33057)
* propagate unknown and sensitive metadata to dynamic attributes

* update goimports and add some comments
2023-04-24 10:28:21 +02:00
Liam Cervante
357012a2f3
Refactor of differ to make code reuse easier (#33054)
* refactor of differ to make code reuse easier

* fix imports
2023-04-21 09:51:55 +02:00
Liam Cervante
aae6990d38
Add native plantimestamp function to Terraform (#32980)
* add plantimestamp function

* documentation

* add missing links

* fix typo
2023-04-21 09:47:28 +02:00
Sebastian Rivera
e6c3aab6c5
Merge pull request #33018 from hashicorp/tf-5529-sro-tfe-version-check 2023-04-14 11:55:12 -04:00
Liam Cervante
2c624acea1
Fix rendering unknown values in map and null string primitives (#33029)
* fix rendering unknown values in map and null string primitives

* Update map.go

* fix code consistency checks
2023-04-14 09:56:32 +02:00
Sebastian Rivera
300a60f393 Fix typo in format version check 2023-04-13 18:30:56 -04:00
Liam Cervante
978263efe9
Checks: Introduce check blocks into the terraform node and transform graph (#32735)
* Add support for scoped resources

* refactor existing checks addrs and add check block addr

* Add configuration for check blocks

* introduce check blocks into the terraform node and transform  graph

* address comments

* address comments

* don't execute checks during destroy operations

* don't even include check nodes for destroy operations
2023-03-23 16:07:31 +01:00
James Bardin
86c0c3bf80
Merge pull request #32846 from hashicorp/fix-32793
emit a warning msg if invalid CLI configuration file location
2023-03-14 14:58:47 -04:00
Reda Khaled
bf723bd65a fix(init_test.go): in TestInitProvidersLocalOnly tst, set TF_CLI_CONFIG_FILE env var to an empty val 2023-03-14 14:47:43 -04:00
Reda Khaled
fa9d044c58 bugfix(cliconfig.go): emit a warning msg if bad CLI config file path 2023-03-14 14:47:43 -04:00
James Bardin
06f1ceb026 add some output values to the show state test 2023-03-14 10:04:37 -04:00
James Bardin
5ed7f2a798 always use the RenderHuman constructor 2023-03-14 10:04:28 -04:00
Liam Cervante
15ecdb66c8
Fix no-op outputs causing the plan renderer to skip the 'no changes' message (#32820)
* Fix no-op outputs causing the plan renderer to skip the 'no changes' message

* fix imports
2023-03-10 16:19:33 +01:00
Alisdair McDiarmid
8df065a2fe initwd: Switch from earlyconfig to configs
This is a mostly mechanical refactor with a handful of changes which
are necessary due to the semantic difference between earlyconfig and
configs.

When parsing root and descendant modules in the module installer, we now
check the core version requirements inline. If the Terraform version is
incompatible, we drop any other module loader diagnostics. This ensures
that future language additions don't clutter the output and confuse the
user.

We also add two new checks during the module load process:

* Don't try to load a module with a `nil` source address. This is a
  necessary change due to the move away from earlyconfig.

* Don't try to load a module with a blank name (i.e. `module ""`).
  Because our module loading manifest uses the stringified module path
  as its map key, this causes a collision with the root module, and a
  later panic. This is the bug which triggered this refactor in the
  first place.
2023-03-06 09:14:28 -05:00
Reda Khaled
100c44b6c3
bugfix: issue-28274, terraform providers mirror command should honor terraform lock file 2023-02-25 00:16:46 +01:00
Martin Atkins
a86cef4d50 cliconfig: Allow breaking the dependency lock file using the environment
Since it's already possible to activate the dependency lock file using an
environment variable, we should allow opting in to it having broken
behavior using the environment too.

It's kinda odd in retrospect that TF_PLUGIN_CACHE_DIR is the only setting
we allow to be configured both in the environment and the CLI
configuration. That means that the infrastructure for dealing with that
situation was relatively immature here and so I did some light refactoring
to make it unit-testable without actually modifying the test program's
environment.
2023-02-22 12:23:56 -08:00
CJ Horton
3c54e42080
Merge pull request #32695 from hashicorp/radditude/init-config-warning
keep errors friendly when init encounters syntax problems
2023-02-21 16:09:05 -08:00
kmoe
b435b4ccde
cliconfig: more provider_installation err detail (#32722) 2023-02-21 18:18:57 +00:00
Sebastian Rivera
6d0a191ec4 Handle provisioner log types in renderer 2023-02-16 10:54:58 -05:00
CJ Horton
30f8b014f8 keep the friendly error message whenever possible 2023-02-15 21:40:46 -08:00
CJ Horton
727e22e762 add tests for init syntax error handling
With the demise of the early config loader, we want to show core
version errors first, followed by backend errors, and only then
show other errors with the configuration.
2023-02-15 21:01:27 -08:00
Daniel Banck
4fa77727b5
Introduce metadata functions command (#32487)
* Add metadata functions command skeleton

* Export functions as JSON via cli command

* Add metadata command

* Add tests to jsonfunction package

* WIP: Add metadata functions test

* Change return_type & type in JSON to json.RawMessage

This enables easier deserialisation of types when parsing the JSON.

* Skip is_nullable when false

* Update cli docs with metadata command

* Use tfdiags to report function marshal errors

* Ignore map, list and type functions

* Test Marshal function with diags

* Test metadata functions command output

* Simplify type marshaling by using cty.Type

* Add static function signatures for can and try

* Update internal/command/jsonfunction/function_test.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

---------

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
2023-02-14 14:08:47 +00:00
Liam Cervante
d212a72d1d
structured run output: impose canonical ordering on jsonstate and jsonplan packages (#32649) 2023-02-13 15:40:17 +01:00
Sebastian Rivera
de574ae6d4
Initial implementation of structured logging in cloud backend (#32504)
* Implementation of structured logging.

These are the changes that enable the cloud backend to consume
structured logs and make use of the new plan renderer. This will enable
CLI-driven runs to view the structured output in the Terraform Cloud UI.

* Cloud structured logging unit tests

* Remove deferred logs logic, fix minor issues

Color formatting fixes, log type stop lists, default behavior for logs
that are unknown

* Use service disco path in redacted plan url
2023-02-09 13:35:48 +01:00
Liam Cervante
4fa7cd0a68
structured renderer: fix closing json tags when rendering with no symbols (#32642) 2023-02-08 16:47:12 +01:00
Liam Cervante
d818d7850d
Structured Renderer: use the new renderer when rendering the state in addition to the plan (#32629)
* Use the new renderer when rendering the state

* remove confusing and unneeded comment
2023-02-07 09:14:14 +01:00
zetHannes
c70244426a
Fix for no json output of state locking actions for --json flag (#32451)
* Add viewType to Meta object and use it at the call sites

* Assign viewType passed from flags to state-locking cli commands

* Remove temp files

* Set correct mode for statelocker depending on json flag passed to commands

* Add StateLocker interface conformation check for StateLockerJSON

* Remove empty line at end of comment

* Pass correct ViewType to StateLocker from Backend call chain

* Pass viewType to backend migration and initialization functions

* Remove json processing info in process comment

* Restore documentation style of backendMigrateOpts
2023-02-07 09:06:12 +01:00
Brandon Croft
9fd76e56cd
Factor out terraform-config-inspect/tfconfig during init
As explained by the deleted comments, this package was used to identify situations where the `terraform 0.12upgrade` command can help migrate 0.11 syntax. Current versions of terraform don't include this command, and it's not likely that users are attempting upgrades from 0.11 to 1.4+

The replacement init swaps the order of the module and backend initialization in order to prepare for the next commit.

Config initialization now takes the following approach:
1. Load the root module, but withhold diagnostic errors until after version check
2. Initialize the backend, but withhold diagnostic errors until after version check
3. Get modules
4. Load all config (root and modules)
5. Check terraform version requirements (this can be defined by nested modules) and display any errors. It's important to show these first because prior errors could be the result of a newer terraform version syntax
6. Finally, show any errors related to backed init or config loading
2023-01-30 17:21:23 -07:00
Sheridan C Rawlins
75e5ae27a2
[fixes 31700] Add mTLS support for http backend by way of client cert & key, as well as enterprise cacert. (#31699)
* Add mTLS support for http backend by way of client cert & key, as well as enterprise cacert.

* Fix style.

* Skip cert validation to be sure error is related to missing client cert; not untrusted server cert.

* Remove misplaced err check.

* Fix the size of test using http backend.

* Just for correctness, include all certs in the pem encoded cert - sometimes certs come with a chain of their signers.

* Adjusted names as recommended in PR comments.

* Adjusted names to be full-length and more descriptive.

* Added full-fledged testing with mTLS http server

* Fix goimports.

* Fix the names of the backend config.

* Exclusive lock for write and delete.

* Revert "Fix goimports."

This reverts commit 7d40f6099fbbb675fb2e25e35ee40aeafe3d0a22.

* goimports just for server test.

* Added the go:generation for the mock.

* Move the TLS configuration out to make it more readable - don't replace the HTTPClient as the retryablehttp already creates one - just configure its TLS.

* Just switch the client/data params - felt more natural this way.

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/testdata/gencerts.sh

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/backend/remote-state/http/backend.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* the location of the file name is not sensitive.

* Added error if only one of client_certificate_pem and client_private_key_pem are set.

* Remove testify from test cases; use t.Error* for assert and t.Fatal* for require.

* Fixed import consistency

* Just use default openssl.

* Since file(...) is so trivial to use, changed the client cert, key, and ca cert to be the data.

See also https://github.com/hashicorp/terraform-provider-http/pull/211

Co-authored-by: Sheridan C Rawlins <scr@ouryahoo.com>
Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
2023-01-26 14:08:07 +00:00
Martin Atkins
e2380b1038 cliconfig: Allow forcing use of the plugin cache despite the lock file
Currently Terraform will use an entry from the global plugin cache only if
it matches a checksum already recorded in the dependency lock file. This
allows Terraform to produce a complete lock file entry on the first
encounter with a new provider, whereas using the cache in that case would
cause the lock file to only cover the single package in the cache and
thereefore be unusable on any other operating system or CPU architecture.

This temporary CLI config option is a pragmatic exception to support those
who cannot currently correctly use the dependency lock file but who still
want to benefit from the plugin cache. With this setting enabled,
Terraform has permission to produce a dependency lock file that is only
suitable for the current system if that would allow use of an existing
entry in the plugin cache.

We are introducing this option to resolve a conflict between the needs of
folks who are using the dependency lock file as expected and the needs of
folks who cannot use the dependency lock file for some reason. The hope
then is to give respite to those who need this exception in the meantime
while we understand better why they cannot use the dependency lock file
and improve its design so that everyone will be able to use it
successfully in a future version of Terraform. This option will become a
silent no-op in a future version of Terraform, once the dependency lock
file behavior is sufficient for all supported Terraform development
workflows.
2023-01-25 08:23:01 -08:00
Liam Cervante
7d1ea52077
Structured Plan Renderer: another round of fixes after more equivalence testing (#32537)
* Structured Plan Renderer: another round of fixes after more equivalence testing

* fix sort function

* use new constants
2023-01-20 09:24:22 +01:00
Liam Cervante
6dc49150b7
Structured Plan Renderer: Read the data source schemas from the right place (#32532)
* read the data source schemas from the right place

* address comments and add test
2023-01-19 15:37:02 +01:00
Liam Cervante
8d61c5bfc4
Use the new structured renderer in place of the old diffs package (#32520)
* Use the new structured renderer in place of the old diffs package

* remove old plan tests

* refresh only plans should show moved resources in the refresh section
2023-01-18 10:14:54 +01:00
Liam Cervante
99823e4a15
Structured Plan Renderer: Fix minor bugs causing diffs in the equivalence tests. (#32519)
* remove attributes that do not match the relevant attributes filter

* fix formatting

* fix renderer function, don't drop irrelevant attributes just mark them as no-ops

* fix imports

* fix bugs in the renderer exposed by the equivalence tests

* imports

* gofmt
2023-01-17 09:31:29 +01:00
Liam Cervante
e015b15f12
Structured Plan Renderer: Remove attributes that do not match the relevant attributes filter (#32509)
* remove attributes that do not match the relevant attributes filter

* fix formatting

* fix renderer function, don't drop irrelevant attributes just mark them as no-ops

* fix imports
2023-01-16 15:18:38 +01:00
Liam Cervante
95782f2491
Structured plan renderer: Implement the main functionality for the renderer (#32496)
* raw unmodified broken tests

* tests execute, no panics

* fix whitespace differences

* fix all the tests

* fix tests

* actually fix tests

* add missing plan metadata into the renderer

* address comments

* complete merge

* remove TODO raising questions about outputs, they are fixed

* missing bold on plan
2023-01-12 17:59:07 +01:00
Liam Cervante
af0ff90d6e
Remove outputs from the jsonplan that are not from the root module (#32503) 2023-01-12 17:02:29 +01:00
Liam Cervante
c125397da1
push the colorize actions as locally as possible (#32502) 2023-01-12 16:47:06 +01:00
James Bardin
96b1318167 remove deprecated condition_results from plan 2023-01-11 16:03:32 -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
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