Commit Graph

2025 Commits

Author SHA1 Message Date
Elbaz
20aa339579 Merge remote-tracking branch 'origin/main' into chore-add-is-files-sorted-test
# Conflicts:
#	internal/command/test_test.go
2023-09-05 15:15:35 +03:00
Elbaz
39172c7bc5
Merge branch 'main' into test-refresh-only-test 2023-09-03 17:29:15 +03:00
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
RLRabinowitz
a4554a0a75 Change text to OPENTF CRASH on crash
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2023-09-03 12:17:35 +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
0afa80282e Remove terraform test file names in internal/cloud tests 2023-08-28 17:16:27 +03:00
RLRabinowitz
035896a665 Remove terraform test file names in internal/backend/remote tests 2023-08-28 17:14:19 +03:00
RLRabinowitz
3dd8fc9943 Remove terraform mention from TF file names 2023-08-28 17:10:28 +03:00
RLRabinowitz
d18709dcd4 Remove terraform name where possible in internal/providercache tests 2023-08-28 16:57:42 +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
12e8eeaa09 Rename files in internal/terraform 2023-08-28 14:21:33 +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
e2133042af unused func 2023-08-28 12:02:35 +03:00
Elbaz
5c74d466ce update to use const opentf 2023-08-28 11:35:51 +03:00
Elbaz
d1b585bab6 remove redundent stringf 2023-08-27 17:40:55 +03:00
Elbaz
6fd17682dd added log 2023-08-27 17:39:55 +03:00
Elbaz
de001ef784 rename func application 2023-08-27 17:39:27 +03:00
Elbaz
9362df1d9e rename func 2023-08-27 17:38:54 +03:00
Elbaz
b4a1e86ec6 last test fix 2023-08-27 16:03:22 +03:00
RLRabinowitz
19239936a4 Rename internal/legacy/terraform to internal/legacy/opentf 2023-08-27 15:58:38 +03:00
Elbaz
29b04c6966 fix tests 2023-08-27 15:53:27 +03:00
RLRabinowitz
0943bd6848 Fix typo 2023-08-27 15:42:46 +03:00
RLRabinowitz
c6ff52a4a9 Rename internal/builtin/providers/terraform to internal/builtin/providers/tf 2023-08-27 15:40:02 +03:00
Elbaz
2cdedaf734 added combined tests 2023-08-27 15:32:14 +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
Elbaz
3f837f90e6 update tests 2023-08-27 15:00:43 +03:00
Elbaz
092d34b055 sort imports 2023-08-27 14:49:32 +03:00
Elbaz
1f0875ba68 move import 2023-08-27 14:46:17 +03:00
Elbaz
23d5d4daff move import 2023-08-27 14:45:49 +03:00
RLRabinowitz
b6d4ac7d62 Remove unused internal/provider-terraform folder 2023-08-27 14:42:38 +03:00
Elbaz
542852c8d8 fix broken tests 2023-08-27 14:42:29 +03:00
Elbaz
9cb0e43e9d fix references 2023-08-27 14:07:37 +03:00
Elbaz
6bca34e28d rollback 2023-08-27 13:55:39 +03:00
Elbaz
7723d93946 export more commons 2023-08-27 13:55:04 +03:00
Elbaz
7078034160 update backend to use common user agent 2023-08-27 13:48:30 +03:00
Elbaz
6c86f6ba51 update 2023-08-27 13:46:13 +03:00
Elbaz
57b05912e1 test 2023-08-27 13:43:29 +03:00
RLRabinowitz
ef0bcc3d43 Rename terraform_attr file and debug-terraform script 2023-08-27 13:34:20 +03:00
RLRabinowitz
30b121f9fe Rename terraform_test file 2023-08-27 13:27:02 +03:00
Elbaz
7563a92e1e remove deprecated function 2023-08-27 12:21:47 +03:00
Elbaz
77c668de0c export to useragent 2023-08-27 12:17:01 +03:00
Elbaz
32156899de rollback some chagnes 2023-08-27 12:03:53 +03:00
Elbaz
116af60275 rename user agent 2023-08-27 11:58:02 +03:00
Marcin Wyszynski
6e0908d53f
Introduce a snapshot check for equivalence tests (#168)
* Introduce a snapshot check for equivalence tests

* New snapshots

* Allow overriding plan timestamp for snapshots

* Allow setting the seed externally (as an env var) for testing purposes

* Remove an equivalence test that depends on a random number
2023-08-25 13:06:29 +02: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
Elbaz
9cf8485255
Merge pull request #130 from opentffoundation/update-intenal-legacy 2023-08-24 11:31:36 +03:00
RLRabinowitz
9a782acc13
Merge pull request #104 from opentffoundation/opentf-user-facing-internal-lang
Adapt user-facing usages of terraform in `internal/lang`
2023-08-24 10:15:13 +03: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
90a0d7cc27
Merge pull request #121 from opentffoundation/opentf-user-facing-internal-plans
Adapt user-facing usages of terraform in `internal/plans`
2023-08-23 14:11:18 +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
RLRabinowitz
716daf8deb
Merge pull request #97 from opentffoundation/opentf-user-facing-internal-getmodules
Adapt user-facing usages of terraform in `internal/getmodules`
2023-08-23 13:55:53 +03:00
RLRabinowitz
a9c2139408
Merge pull request #100 from opentffoundation/opentf-user-facing-internal-instances
Adapt user-facing usages of terraform in `internal/instances`
2023-08-23 13:55:42 +03:00
RLRabinowitz
e56251e2f3
Merge pull request #102 from opentffoundation/opentf-user-facing-internal-ipaddr
Adapt user-facing usages of terraform in `internal/ipaddr`
2023-08-23 13:55:23 +03:00
Marcin Wyszynski
26c2e3a4d1
Adapt user-facing usages of terraform in internal/states (#133) 2023-08-23 12:37:04 +02:00
Marcin Wyszynski
a9a78c000d
Adapt user-facing usages of terraform in internal/providercache (#119) 2023-08-23 12:24:02 +02:00
Elbaz
05d59d4441 alters 2023-08-23 13:13:28 +03:00
Marcin Wyszynski
5fa28ede2c
Adapt user-facing usages of terraform in internal/refactoring (#125) 2023-08-23 12:07:11 +02:00
Elbaz
508c4613f5
Merge pull request #93 from opentffoundation/update-get-providers 2023-08-23 13:04:45 +03:00
Elbaz
4ebaf33983 alters 2023-08-23 13:00:23 +03:00
Elbaz
93ccbd82f5
Merge pull request #110 from opentffoundation/update-internal/configs 2023-08-23 12:55:12 +03:00
RLRabinowitz
9c440ea4fd Re-added part of README that was removed, adapting the wording 2023-08-23 12:39:36 +03:00
RLRabinowitz
27e5417752 Adjust mentions of terraform in internal/plans 2023-08-23 12:34:03 +03:00
Marcin Wyszynski
9ef50b3f05
Adapt user-facing usages of terraform in internal/{logging,modsdir,moduledeps,moduletest} (#111) 2023-08-23 11:10:19 +02:00
Elbaz
5e83430db2 fix init test 2023-08-23 11:56:26 +03:00
Elbaz
58853d209c Merge branch 'main' into update-internal/configs 2023-08-23 11:41:13 +03:00
Elbaz
2729114bec missed some 2023-08-23 11:41:04 +03:00
Marcin Wyszynski
2e236adf7c
Update user-facing references to Terraform internal/initwd (#95) 2023-08-23 10:20:53 +02:00
RLRabinowitz
650b1a339a Adjust mentions of terraform in internal/lang 2023-08-23 11:12:15 +03:00
Elbaz
9addf78f1e upper case 2023-08-23 11:09:13 +03:00
RLRabinowitz
58cf4b1ca1
Merge pull request #52 from opentffoundation/opentf-user-facing-internal-dag
Change Terraform to OpenTF in comment regarding the program
2023-08-23 10:49:26 +03:00
RLRabinowitz
7cefa0df5b Update README in internal/ipaddr to match OpenTF 2023-08-23 10:44:43 +03:00
RLRabinowitz
7ab25e5cc2 Update comment in internal/instances to OpenTF 2023-08-23 10:28:53 +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
RLRabinowitz
505d08d670 Adapt user-facing usages of terraform in internal/getmodules 2023-08-23 10:04:24 +03:00
Elbaz
36b43c7c28
Merge pull request #71 from opentffoundation/update-json-format 2023-08-22 19:24:50 +03:00
Elbaz
2be70612c2
Merge pull request #58 from opentffoundation/update-internal-experiments 2023-08-22 19:24:37 +03:00
Elbaz
efea86a1ce update 2023-08-22 19:12:07 +03:00
Elbaz
783b0fc5b8 update 2023-08-22 19:02:07 +03:00
Marcin Białoń
b0fafbe134
Merge pull request #54 from opentffoundation/update-internal-cloud
Change user-facing Terraform occurrences `internal/cloud`
2023-08-22 17:51:35 +02:00
RLRabinowitz
a068f210c9 Adapt user-facing usages of terraform in internal/genconfig 2023-08-22 17:55:49 +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
RLRabinowitz
a23408c2b8 Adapt user-facing usages of terraform in internal/depsfile 2023-08-22 17:45:10 +03:00
Elbaz
3dd3381ca4 update 2023-08-22 17:34:37 +03:00
RLRabinowitz
9ee1c7d178
Merge pull request #49 from opentffoundation/opentf-user-facing-internal-builtin
Change user-facing occurrences of Terraform to OpenTF in `internal/builtin`
2023-08-22 17:33:52 +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
Marcin Białoń
4ecb07bf8f
update references
Signed-off-by: Marcin Białoń <mbialon@spacelift.io>
2023-08-22 16:31:53 +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
52a41ab8f7
Merge pull request #48 from opentffoundation/chore-rename-terraform-to-opentf-in-docs 2023-08-22 17:00:13 +03:00
Elbaz
378c69d652 rename 2023-08-22 16:38:04 +03: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
RLRabinowitz
8fce593c9d Change Terraform to OpenTF in comment regarding the program 2023-08-22 16:18:57 +03:00
RLRabinowitz
af94085881 Change Terraform to OpenTF in comment regarding the code 2023-08-22 16:04:12 +03:00
Yaron Yarimi
a7dc4c85a2 Rename Terraform to OpenTF - missed line 2023-08-22 16:04:05 +03:00
Elbaz
6000fe690e fix warning checks 2023-08-22 15:47:37 +03:00
Yaron Yarimi
24beb7ee5c Renaming terraform to opentf 2023-08-22 15:45:05 +03:00
Elbaz
75ff795326 more naming updates 2023-08-22 15:43:11 +03:00
Elbaz
60770c81a2 update namings 2023-08-22 15:33:08 +03:00
Elbaz
6e17054f15 enterprise 🌈 2023-08-22 14:48:33 +03:00
Elbaz
b3080211d0 rollback protocol namings 2023-08-22 14:20:40 +03:00
Elbaz
ecea3e2591 missed that 2023-08-22 14:15:25 +03:00
Elbaz
080385c86a tf cloud comment 2023-08-22 14:15:14 +03:00
Elbaz
d80141255c last fixes 2023-08-22 12:49:16 +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
2bae75c3f9 rollback 2023-08-22 11:15:00 +03:00
Elbaz
841025ba26 renames 2023-08-22 11:12:20 +03:00
Elbaz
141e72246d fix tests + english 2023-08-21 19:33:20 +03:00
Elbaz
2d9e242dbe
Merge pull request #32 from opentffoundation/update-addrs-user-facing
Rename facing internal/addrs namings
2023-08-21 18:29:04 +03:00
Elbaz
c10a300b58 s3 2023-08-21 18:24:40 +03:00
Elbaz
15ae0bc167 oss 2023-08-21 18:23:08 +03:00
Elbaz
e6d0a90db5 k8s 2023-08-21 18:22:37 +03:00
Elbaz
44da5b5e3a more 2023-08-21 18:21:16 +03:00
Elbaz
a8d998fd9e remote folder 2023-08-21 18:19:35 +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
Elbaz
da73538433 local folder 2023-08-21 16:32:46 +03:00
Elbaz
a017e8f57d init folder 2023-08-21 16:21:27 +03:00
Elbaz
5626ac6926 backend folder 2023-08-21 16:19:40 +03:00
Elbaz
b5cb9f6177 more renames 2023-08-21 15:01:03 +03:00
Elbaz
985e81a1d0 more renames 2023-08-21 14:50:20 +03:00
Elbaz
88100e3d39 Renames 2023-08-21 14:21:14 +03: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
Brandon Croft
8a085b427b
Merge pull request #33590 from hashicorp/TF-7652-terraform-make-plan-out-create-provisional-configuration-versions
Create provisional configuration version when saving plan using cloud backend
2023-08-10 11:50:37 -06: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
James Bardin
f6768de218 handle install errs in installDescendentModules
This will allow us to use the same logic for `get` too.
2023-08-07 15:06:47 -04:00
Brandon Croft
b1d4f18a9b
Create provisional configuration version when saving cloud plan 2023-08-07 11:35:48 -06:00
James Bardin
09d91eb675 test -from-module with invalid root module
Add a test for `init -from-module` with a module which is not a valid
root module.
2023-08-04 10:43:21 -04:00
James Bardin
29c3f650cd allow config errors when using -from-module
When initializing the working directory from a module, some use cases
may still want the module source even when the configuration cannot be
loaded due to validation errors.

Isolate the installation errors during the initialization sequence, so
we can report them if there is a problem fetching the actual module
source. Once we have the module, convert configuration errors to
warnings so the cli initialization can proceed.
2023-08-03 16:05:47 -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
Karl Kirch
d7e07e66fc
Add ability to specify Terraform Cloud Project in cloud block (#33489)
* Add ability to specify Terraform Cloud Project in cloud block

Adds project configuration to the workspaces section of the cloud block.
Also configurable via the `TF_CLOUD_PROJECT` environment variable.
When a project is configured, the following behaviors will occur:
- `terraform init` with workspaces.name configured will create the workspace in the given project
- `terraform workspace new <name>` with workspaces.tags configured will create workspaces in the given project
- `terraform workspace list` will list workspaces only from the given project

The following behaviors are NOT affected by project configuration
- `terraform workspace delete <name>` does not validate the workspace's inclusion in the given project
- When initializing a workspace that already exists in Terraform Cloud, the workspace's parent project is NOT validated against the given project

Adds tests for cloud block configuration of project
Update changelog

* Update cloud block docs

* Fix typos and changelog entry

* Add speculative project lookup early in the cloud initialize process to capture inability to find a configured project

* Add project config for alias test
2023-08-01 13:43:07 -07:00
Liam Cervante
3bea1171af
test framework: expand variables available to test assertions (#33611) 2023-08-01 09:59:29 +02:00
Liam Cervante
bf6f32c19a
test framework: fix bug preventing remaining assertions being checked after one has failed (#33601) 2023-08-01 09:56:51 +02:00
Liam Cervante
4560a83721
test framework: include transformed config before validating config (#33608) 2023-08-01 09:47:00 +02:00
Graham Davison
84edaaed57
Merge pull request #33571 from hashicorp/s3/add-legacy-acceptance-tests
S3 Backend: Add legacy authentication flow tests
2023-07-31 13:27:02 -07: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
Liam Cervante
222676390c
testing framework: add validation for provider blocks in test files (#33542)
* testing framework: add validation for provider blocks in test files

* .tftest -> .tftest.hcl
2023-07-26 10:01:18 +02:00
Liam Cervante
dff447bc9f
fix crash when nested data blocks are mixed with the import command (#33578) 2023-07-26 09:41:00 +02:00
Brandon Croft
14628b9246
Update cloudproto1.pb.go 2023-07-25 09:30:25 -06: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
a806f6220a
Tests the cloudplugin1 gRPC client 2023-07-25 09:28:31 -06:00
Brandon Croft
539e140d3e
Introduces cloudproto1 plugin interface 2023-07-25 09:28:31 -06:00
Brandon Croft
fec1ca69ac
Fix console godoc 2023-07-25 09:28:30 -06:00
Sebastian Rivera
dceb8453af
Merge pull request #33492 from hashicorp/cli-team/saved-cloud-plans
Implement saved cloud plans
2023-07-25 10:29:19 -04:00
Sebastian Rivera
08e58fd484 Fix saved plan test regressions, fixtures 2023-07-25 10:22:46 -04:00
Graham Davison
5588603822
Merge pull request #33534 from hashicorp/s3/update-configschema
S3 Backend: Converts from `legacy/helper/schema` to `configschema`
2023-07-24 17:46:09 -07:00
Graham Davison
8564a5bf0e Fixes type of parameter skip_credentials_validation 2023-07-24 17:36:51 -07:00
Graham Davison
47fc769da9 Adds tests for region 2023-07-24 17:20:16 -07:00
Graham Davison
f3ce646756 Adds authentication tests 2023-07-24 16:23:52 -07:00
Sebastian Rivera
31cf55fe12 Reword error message when using local exec 2023-07-24 14:12:44 -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
f98f920b67 Add error wrapper types to highlight bad plan/state data
This commit uses Go's error wrapping features to transparently add some optional
info to certain planfile/state read errors. Specifically, we wrap errors when we
think we've identified the file type but are somehow unable to use it.

Callers that aren't interested in what we think about our input can just ignore
the wrapping; callers that ARE interested can use `errors.As()`.
2023-07-24 14:12:44 -04:00
Nick Fagerlund
1f35173192 Tests: Add tests for (*Cloud).ShowPlanForRun() 2023-07-24 14:12:44 -04:00
Nick Fagerlund
7f6b827987 Modify tfe client mocks to meet some new requirements
- Add plausible unredacted plan json for `plan-json-{basic,full}` testdata --
  Created by just running the relevant terraform commands locally.

- Add plan-json-no-changes testdata --
  The unredacted json was organically grown, but I edited the log and redacted
  json by hand to match what I observed from a real but unrelated
  planned-and-finished run in TFC.

- Add plan-json-basic-no-unredacted testdata --
  This mimics a lack of admin permissions, resulting in a 404.

- Hook up `MockPlans.ReadJSONOutput` to test fixtures, when present.
  This method has been implemented for ages, and has had a backing store for
  unredacted plan json, but has been effectively a no-op since nothing ever
  fills that backing store. So, when creating a mock plan, make an attempt to
  read unredacted json and stow it in the mocks on success.

- Make it possible to get the entire MockClient for a test backend
  In order to test some things, I'm going to need to mess with the internal
  state of runs and plans beyond what the go-tfe client API allows. I could add
  magic special-casing to the mock API methods, or I could locate the
  shenanigans next to the test that actually exploits it. The latter seems more
  comprehensible, but I need access to the full mock client struct in order to
  mess with its interior.

- Fill in some missing expectations around HasChanges when retrieving a run +
  plan.
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
d5938f6b45 Add (*Cloud).ShowPlanForRun method to support terraform show
To do the "human" version of showing a plan, we need more than just the redacted
plan JSON itself; we also need a bunch of extra information that only the Cloud
backend is in a position to find out (since it's the only one holding a
configured go-tfe client instance). So, this method takes a run ID and hostname,
finds out everything we're going to need, and returns it wrapped up in a
RemotePlanJSON struct.
2023-07-24 14:12:44 -04:00
Nick Fagerlund
e0af3e25e0 Add cloudplan.RemotePlanJSON wrapper struct for keeping plan metadata together 2023-07-24 14:12:44 -04:00
Nick Fagerlund
2a08a5b46e Cloud: Split private readRedactedPlan func into two
Since `terraform show -json` needs to get a raw hunk of json bytes and sling it
right back out again, it's going to be more convenient if plain `show` can ALSO
take in raw json. In order for that to happen, I need a function that basically
acts like `client.Plans.ReadJSONOutput()`, without eagerly unmarshalling that
`jsonformat.Plan` struct.

As a slight bonus, this also lets us make the tfe client mocks slightly
stupider.
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
da963a13b9 Implement plan -out for Cloud
- Don't save errored plans.
- Call op.View.PlanNextStep for terraform plan in cloud mode (We never used to
  show this footer, because we didn't support -out.)
- Create non-speculative config version if saving plan
- Rewrite TestCloud_planWithPath to expect success!
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
Nick Fagerlund
9d85f18930 Add NewSavedPlanBookmark function
so we don't have to remember the format version number
2023-07-24 14:07:16 -04:00
Lauren
dcccd3b266 Add error handling and tests for saved plan bookmark load/save (#33268) 2023-07-24 14:07:16 -04:00
Nick Fagerlund
df7a1c821a Move SavedPlanBookmark to dedicated internal/cloud/cloudplan package
Having this sitting loose in `cloud` proved problematic because of circular
import dependencies. Putting it in a sub-package under cloud frees us up to
reference the type from places like `internal/backend`!
2023-07-24 14:07:16 -04:00
Lauren
717a36036d codify saved plan artifact contents (#33185) 2023-07-24 14:07:16 -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
James Bardin
62ee606752
Merge pull request #33543 from hashicorp/jbardin/get-schema-client-cache
always set schema caches from provider clients
2023-07-19 08:47:25 -04: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
James Bardin
e14b03f7b0 always set schema caches from provider clients
Allow core to always use the global schema cache, so that providers
without GetProviderSchemaOptional are not spun up repeatedly. Rather
than conditionally setting the cache, we just conditionally use the
cache in the client to work around providers without
GetProviderSchemaOptional.
2023-07-18 13:52:41 -04:00
James Bardin
f5d94b35a0
Merge pull request #33486 from hashicorp/jbardin/schema-cache-proto
enable schema caching and add `get_provider_schema_optional` server capability
2023-07-18 11:18:11 -04:00
Graham Davison
344e9de6b9 Linting fixes 2023-07-17 11:34:33 -07: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
Martin Atkins
a7807dac16 main: Optionally configure an OpenTelemetry OTLP exporter
Terraform CLI is sometimes used as part of a larger distributed system, in
which case it would be helpful to be able to gather telemetry from it
as part of the larger request it's being run in response to.

We'll now support optionally enabling an OTLP exporter by setting the
environment variable OTEL_TRACES_EXPORTER=otlp (a standard OpenTelemetry
convention). As of this commit there isn't actually anything emitting
traces to the specified collector, but we'll gradually add tracing
instrumentation to parts of Terraform CLI and Core in later commits.
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
James Bardin
642904204a enable global schema cache 2023-07-10 11:01:19 -04:00
James Bardin
fb35d7fd89 add get_provider_schema_optional server capability 2023-07-10 10:59:15 -04: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
Liam Cervante
f74a8d16cf
[testing framework] implement expect_failures functionality (#33443) 2023-07-10 11:30:44 +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
c42d3b4e51
Merge pull request #33462 from hashicorp/jbardin/destroy-output-provider-refs
always evaluate module outputs during destroy
2023-07-07 09:44:27 -04:00
Graham Davison
d179b686d9 Consolidates endpoint tests 2023-07-06 16:05:52 -07:00
Graham Davison
2f00c86255 Adds endpoint tests when configured in configuration 2023-07-06 16:05:52 -07:00
Graham Davison
90c10ebbe9 Removes redundant ARN parsing 2023-07-06 16:05:52 -07:00
Graham Davison
29e14d148b Reorders skip_... parameters 2023-07-06 16:05:52 -07:00