Commit Graph

589 Commits

Author SHA1 Message Date
Elbaz
c676d74fc6 Add Tests
Signed-off-by: Elbaz <eran.elbaz@env0.com>
2023-09-03 16:54:24 +03:00
RLRabinowitz
b08933aeb1 Normalise lines in ned of test files
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2023-09-03 16:37:05 +03:00
RLRabinowitz
c3ec988d94 Rely on StdOut and StdError in tests, to avoid issues with output order
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2023-09-03 16:37:05 +03:00
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