Commit Graph

156 Commits

Author SHA1 Message Date
Anna Winkler
3cc7e55465
Expand error when discovery document request fails (#32394)
* Expand error when discovery document request fails.
* Use error type from svchost library
* Use svchost v0.0.1
2023-01-24 15:19:12 -07:00
Nick Fagerlund
acf7314587 Fix typo in cloud backend's TestCloud_setConfigurationFields
This was clearly wrong, but it was also harmless -- in the event of a failing
test due to missing tags, they would get double-reported as both missing and
unexpected. This commit separates out the reporting as intended.
2023-01-19 18:33:14 -08:00
mrinalirao
dcd2826277 refactor runTaskStage func & use multierrors lib 2023-01-16 14:36:17 +11:00
mrinalirao
4d2e75bbda Merge branch 'mr/refactor-task-stage' into mr/policy-evaluation
# Conflicts:
#	internal/cloud/backend_taskStages.go
2023-01-13 10:33:01 +11:00
mrinalirao
d11aa099cc • return error on task stage failed, canceled or errored
• refactor Poll func to pass backoff interval for task stage
2022-12-08 12:42:43 +11:00
mrinalirao
a5add7e361 modify Poll func to pass in backoff interval 2022-12-02 15:22:26 +11:00
mrinalirao
15288caf64 Code Improvements:
- Use tfe consts instead of hardcoded values
- fix logic when polling taskStage
- remove inaccurate comment
2022-12-02 10:15:51 +11:00
mrinalirao
5c5b1099c8 refactor runTaskStage 2022-12-02 09:33:59 +11:00
mrinalirao
f993106e49 fix logic in MultiErrors append func 2022-12-01 08:42:25 +11:00
mrinalirao
5dea138a11 fix logic in multiErrors Append func 2022-12-01 08:40:57 +11:00
mrinalirao
191a5f1018 add test for override 2022-11-30 14:54:03 +11:00
mrinalirao
e36886c0e7 add task stage override 2022-11-30 10:46:28 +11:00
mrinalirao
2be890a37c add policy evaluation task stage 2022-11-29 15:10:23 +11:00
mrinalirao
d7c7f3689c refactor task results to run as a task stage 2022-11-29 11:57:51 +11:00
James Bardin
79175b29f3
Merge pull request #32261 from sivchari/fix-prealloc
fix: pre allocate for composite literal
2022-11-22 09:18:47 -05:00
Jarrett Spiker
cebd5e3fce Upgrade go-tfe to 1.12.0 2022-11-21 14:54:07 -05:00
Jarrett Spiker
c16d726f2c Succeed cloud workspace deletion if the workspace does not exist 2022-11-21 14:35:33 -05:00
Jarrett Spiker
1dafd7c0b1 Fix test compilation errors caused by interface change 2022-11-21 14:35:33 -05:00
Jarrett Spiker
060255a9d5 Use safe or force workspace delete for cloud backend 2022-11-21 14:35:33 -05:00
sivchari
ef4798de8e fix: pre allocate for composite literal 2022-11-22 02:20:54 +09:00
Glenn Sarti
1773129832 Add tests for cloud backend taskStage 2022-09-21 09:40:52 +08:00
Glenn Sarti
43371b8293 Add support for pre-apply task results in the cloud backend
Previously the cloud backend only supported the pre and post plan stages.
This commit adds support to display the output of the new pre-apply task
stage as well.
2022-09-20 16:18:33 +08:00
Glenn Sarti
18da2f0213 Refactor task stage retrieval in cloud backend
Previously all of the logic to retrieve Task Stages was in the backend_plan.go file.
This commit:
* Moves the logic to the backend_taskStages.go file.
* Replaces using an array to a map indexed by the Task Stage's stage. This makes it
  easier to find the relevant stage in the list and means the getTaskStageIDByName
  function is no longer required.
2022-09-20 16:18:33 +08:00
Megan Bang
72ba8a869e removes EnableForcePush and other unrelated code 2022-09-02 14:49:25 -05:00
Megan Bang
5eaa4c45c0 fix imports 2022-08-30 17:27:15 -05:00
Megan Bang
de8bd5826f first part of code review comments 2022-08-30 17:01:44 -05:00
Megan Bang
7e5b7b283e updates for code consistency 2022-08-30 09:49:09 -05:00
Megan Bang
dbf99f17b1 add test and removed backend state from cloud 2022-08-29 16:26:06 -05:00
Megan Bang
bddf6a9b34 updating to use the latest version of cloud/state.go and just pass schemas along to PersistState in the remote state 2022-08-29 14:13:18 -05:00
Megan Bang
344379f5c7 fix cloud state breaking? 2022-08-26 16:26:09 -05:00
Megan Bang
021f1f69e9 updates to cloud state 2022-08-26 14:18:34 -05:00
Megan Bang
4fab46749a update persist state 2022-08-25 14:57:40 -05:00
Martin Atkins
783a07d9e8 build: Use Go 1.19
Go 1.19's "fmt" has some awareness of the new doc comment formatting
conventions and adjusts the presentation of the source comments to make
it clearer how godoc would interpret them. Therefore this commit includes
various updates made by "go fmt" to acheve that.

In line with our usual convention that we make stylistic/grammar/spelling
tweaks typically only when we're "in the area" changing something else
anyway, I also took this opportunity to review most of the comments that
this updated to see if there were any other opportunities to improve them.
2022-08-22 10:59:12 -07:00
Glenn Sarti
8562f8a744 Add Pre-Plan Run Tasks to Terraform CLI
Prevously the cloud backend would only render post-plan run tasks. Now
that pre-plan tasks are in beta, this commit updates the plan phase to
render pre-plan run tasks.  This commit also moves some common code to
the common backend as it will be used by other task stages in the
future.
2022-08-18 10:08:57 +08:00
Brandon Croft
50d48c635e
remove unused error and fix output authorization detection 2022-07-28 11:44:16 -06:00
Brandon Croft
0139e75a1a
feature: fall back to reading entire state when detailed-type is not available 2022-07-25 17:17:24 -06:00
Brandon Croft
e1fa690879
style: goimports fixes 2022-07-25 14:51:34 -06:00
Brandon Croft
166d21b20b
refactor: extract cloud state ctyValue conversion function 2022-07-25 14:48:32 -06:00
Brandon Croft
e794efc31e
better errors from terraform output when cloud is configured 2022-07-25 10:05:20 -06:00
Brandon Croft
c33c8b013f
fix: have terraform output adhere to authorization w/ cloud
Normally, `terraform output` refreshes and reads the entire state in the command package before pulling output values out of it. This doesn't give Terraform Cloud the opportunity to apply the read state outputs org permission and instead applies the read state versions permission.

I decided to expand the state manager interface to provide a separate GetRootOutputValues function in order to give the cloud backend a more nuanced opportunity to fetch just the outputs. This required moving state Refresh/Read code that was previously in the command into the shared backend state as well as the filesystem state packages.
2022-07-25 10:04:43 -06:00
Brandon Croft
7892cb6b5a
reformat imports using goimports 2022-07-22 12:03:03 -06:00
Brandon Croft
0b9bd2fc36
make cloud backend_state error messages more conventional 2022-07-22 11:31:48 -06:00
Brandon Croft
01d510f3cb
test(cloud): ensure state version is created when saving state 2022-07-22 11:26:28 -06:00
Anna Winkler
d72911a640 Save detailed type outputs to JSONStateOutputs 2022-07-22 10:28:20 -06:00
Luces Huayhuaca
70ddcc7d0d
add url to summary and check for optional values (#30993) 2022-05-31 13:48:07 -07:00
Anna Winkler
22c121df86
Bump compatibility version to 1.3.0 for terraform core release (#30988)
* Bump compatibility version to 1.3.0 for terraform core release

Co-authored-by: Brandon Croft <brandon.croft@gmail.com>
2022-05-03 12:28:41 -06:00
Luces Huayhuaca
ea1f0007ff
fix typo for task.Status (#30978) 2022-05-02 11:52:22 -07:00
Sebastian Rivera
9d7fdbea2d Handle -input=false in cloud integration
For non-interactive contexts, Terraform is typically executed with the flag -input=false.
However for runs that are not set to auto approve, the cloud integration will prompt a user for
approval input even with input being set to false. This commit enables the cloud integration to know
the value of the input flag and use it to determine whether or not to ask the user for input.

If -input is set to false and the run cannot be auto approved, the cloud integration will throw an error
stating run confirmation can no longer be handled in the CLI and that they must do so through the browser.
2022-04-26 11:17:44 -04:00
Sebastian Rivera
5ded48e081 Give token in cloud config higher precedence than CLI config file 2022-04-22 14:09:20 -04:00
Sebastian Rivera
f63ef2b5ef Rename cloud env vars to use TF_CLOUD prefix 2022-04-20 14:34:53 -04:00