terraform/backend/local
Martin Atkins 0fe43c8977 cli: allow disabling "next steps" message in terraform plan
In #15884 we adjusted the plan output to give an explicit command to run
to apply a plan, whereas before this command was just alluded to in the
prose.

Since releasing that, we've got good feedback that it's confusing to
include such instructions when Terraform is running in a workflow
automation tool, because such tools usually abstract away exactly what
commands are run and require users to take different actions to
proceed through the workflow.

To accommodate such environments while retaining helpful messages for
normal CLI usage, here we introduce a new environment variable
TF_IN_AUTOMATION which, when set to a non-empty value, is a hint to
Terraform that it isn't being run in an interactive command shell and
it should thus tone down the "next steps" messaging.

The documentation for this setting is included as part of the "...in
automation" guide since it's not generally useful in other cases. We also
intentionally disclaim comprehensive support for this since we want to
avoid creating an extreme number of "if running in automation..."
codepaths that would increase the testing matrix and hurt maintainability.

The focus is specifically on the output of the three commands we give in
the automation guide, which at present means the following two situations:

* "terraform init" does not include the final paragraphs that suggest
  running "terraform plan" and tell you in what situations you might need
  to re-run "terraform init".
* "terraform plan" does not include the final paragraphs that either
  warn about not specifying "-out=..." or instruct to run
  "terraform apply" with the generated plan file.
2017-09-14 10:51:41 -07:00
..
test-fixtures core: Move Refreh/Plan diff count to general operation test 2017-06-24 07:54:40 -07:00
backend.go cli: allow disabling "next steps" message in terraform plan 2017-09-14 10:51:41 -07:00
backend_apply.go command: various adjustments to the diff presentation 2017-09-01 17:55:05 -07:00
backend_apply_test.go backend/local: create local state file if backend write fails 2017-05-23 11:18:01 -07:00
backend_local.go Add warning to mismatched plan state 2017-07-17 10:41:29 -04:00
backend_plan.go cli: allow disabling "next steps" message in terraform plan 2017-09-14 10:51:41 -07:00
backend_plan_test.go cli: allow disabling "next steps" message in terraform plan 2017-09-14 10:51:41 -07:00
backend_refresh.go provide contexts to clistate.Lock calls 2017-04-01 17:09:20 -04:00
backend_refresh_test.go backend/local: refresh with no config should not crash on input 2017-02-22 13:10:08 -08:00
backend_test.go command + backend: rename various API objects to "Workspace" terminology 2017-06-09 16:26:25 -07:00
cli.go cli: allow disabling "next steps" message in terraform plan 2017-09-14 10:51:41 -07:00
counthookaction_string.go Fix stringer comments (#15069) 2017-06-05 10:17:35 +01:00
hook_count.go core: Skip diff hooks for stubs on eval altogether 2017-06-24 08:01:17 -07:00
hook_count_action.go backend/local 2017-01-26 14:33:49 -08:00
hook_count_test.go core: Skip diff hooks for stubs on eval altogether 2017-06-24 08:01:17 -07:00
hook_state.go Revert "have StateHook periodically PersistState" 2017-06-07 16:25:19 -07:00
hook_state_test.go Revert "have StateHook periodically PersistState" 2017-06-07 16:25:19 -07:00
local_test.go backend/local 2017-01-26 14:33:49 -08:00
testing.go command + backend: rename various API objects to "Workspace" terminology 2017-06-09 16:26:25 -07:00