opentofu/internal/command
Martin Atkins fda0579537 Experiments supported only in alpha/dev builds
We originally introduced the idea of language experiments as a way to get
early feedback on not-yet-proven feature ideas, ideally as part of the
initial exploration of the solution space rather than only after a
solution has become relatively clear.

Unfortunately, our tradeoff of making them available in normal releases
behind an explicit opt-in in order to make it easier to participate in the
feedback process had the unintended side-effect of making it feel okay
to use experiments in production and endure the warnings they generate.
This in turn has made us reluctant to make use of the experiments feature
lest experiments become de-facto production features which we then feel
compelled to preserve even though we aren't yet ready to graduate them
to stable features.

In an attempt to tweak that compromise, here we make the availability of
experiments _at all_ a build-time flag which will not be set by default,
and therefore experiments will not be available in most release builds.

The intent (not yet implemented in this PR) is for our release process to
set this flag only when it knows it's building an alpha release or a
development snapshot not destined for release at all, which will therefore
allow us to still use the alpha releases as a vehicle for giving feedback
participants access to a feature (without needing to install a Go
toolchain) but will not encourage pretending that these features are
production-ready before they graduate from experimental.

Only language experiments have an explicit framework for dealing with them
which outlives any particular experiment, so most of the changes here are
to that generalized mechanism. However, the intent is that non-language
experiments, such as experimental CLI commands, would also in future
check Meta.AllowExperimentalFeatures and gate the use of those experiments
too, so that we can be consistent that experimental features will never
be available unless you explicitly choose to use an alpha release or
a custom build from source code.

Since there are already some experiments active at the time of this commit
which were not previously subject to this restriction, we'll pragmatically
leave those as exceptions that will remain generally available for now,
and so this new approach will apply only to new experiments started in the
future. Once those experiments have all concluded, we will be left with
no more exceptions unless we explicitly choose to make an exception for
some reason we've not imagined yet.

It's important that we be able to write tests that rely on experiments
either being available or not being available, so here we're using our
typical approach of making "package main" deal with the global setting
that applies to Terraform CLI executables while making the layers below
all support fine-grain selection of this behavior so that tests with
different needs can run concurrently without trampling on one another.

As a compromise, the integration tests in the terraform package will
run with experiments enabled _by default_ since we commonly need to
exercise experiments in those tests, but they can selectively opt-out
if they need to by overriding the loader setting back to false again.
2022-06-17 14:46:07 -07:00
..
arguments cli: Migrate show command to use command arguments and views 2022-01-13 11:00:03 -06:00
cliconfig fix(creds): allow periods in TF_TOKEN_... credentials vars 2022-04-15 12:38:14 -06:00
clistate Upgrade to Go 1.17 2021-08-17 15:20:05 -07:00
e2etest build: Write the detected version number into the generated executable 2022-05-23 16:48:34 -07:00
format core: Report reason for deferring data read until apply 2022-05-09 11:12:47 -07:00
jsonconfig jsonconfig: add implicitly created provider configs 2022-02-19 01:55:09 +09:00
jsonplan Merge pull request #31235 from hashicorp/alisdair/json-plan-unknown-outputs 2022-06-17 11:50:21 -04:00
jsonprovider Merge pull request #29648 from hashicorp/jbardin/tfproto6.1 2021-10-28 16:00:02 -04:00
jsonstate json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
testdata json-output: Extended detail for unknown outputs 2022-06-13 14:06:03 -04:00
views core: Report reason for deferring data read until apply 2022-05-09 11:12:47 -07:00
webbrowser Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
workdir test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
apply_destroy_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
apply_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
apply.go command: Adjust skipping of resource counts for any remote implementation 2021-10-29 21:23:28 -05:00
autocomplete_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
autocomplete.go Fix autocomplete for workspace subcommands 2022-01-08 14:41:20 +11:00
cli_ui_test.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
cli_ui.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
command_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
command.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
console_interactive_solaris.go Upgrade to Go 1.17 2021-08-17 15:20:05 -07:00
console_interactive.go remove wrapped streams and readline 2021-10-28 11:51:39 -04:00
console_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
console.go Merge pull request #29825 from hashicorp/jbardin/no-panicwrap 2021-10-29 14:41:05 -04:00
flag_kv_test.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
flag_kv.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
fmt_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
fmt.go Move configs/ to internal/configs/ 2021-05-17 14:09:07 -07:00
get_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
get.go command: make module installation interruptible 2021-11-11 12:28:10 +00:00
graph_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
graph.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
hook_module_install.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
import_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
import.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
init_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
init.go double word removed (#30679) 2022-03-25 14:31:52 +00:00
login_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
login.go insert panic handlers 2021-10-28 11:51:39 -04:00
logout_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
logout.go Fix problems caught by staticcheck v0.3.0 2022-04-04 08:12:44 -07:00
meta_backend_migrate_test.go Backend State Migration to cloud: Multiple Workspaces 2021-10-28 19:29:13 -05:00
meta_backend_migrate.go Do not ask to migrate empty default workspace 2021-12-01 11:43:41 -06:00
meta_backend_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
meta_backend.go fix for cloud integration panic 2022-03-30 17:50:08 -04:00
meta_config.go Experiments supported only in alpha/dev builds 2022-06-17 14:46:07 -07:00
meta_dependencies.go backend/local: Check dependency lock consistency before any operations 2021-10-01 14:43:58 -07:00
meta_new.go Move plans/ to internal/plans/ 2021-05-17 14:09:07 -07:00
meta_providers.go command: Early error message for missing cache entries of locked providers 2021-10-05 10:59:59 -07:00
meta_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
meta_vars.go cli: Improved error for invalid -var "foo = bar" 2022-05-03 09:14:29 -04:00
meta.go Experiments supported only in alpha/dev builds 2022-06-17 14:46:07 -07:00
output_test.go Move states/ to internal/states/ 2021-05-17 14:09:07 -07:00
output.go Merge pull request #29354 from srdecny/main 2022-05-20 10:58:09 -07:00
plan_test.go cli: Improved error for invalid -var "foo = bar" 2022-05-03 09:14:29 -04:00
plan.go Clarify multiple times usage (#30724) 2022-03-30 09:52:49 +01:00
plugins_lock_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
plugins_lock.go core: Simplify and centralize plugin availability checks 2021-10-01 14:43:58 -07:00
plugins_test.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plugins.go workdir: Start of a new package for working directory state management 2021-09-10 14:56:49 -07:00
providers_lock_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
providers_lock.go providers subcommand tests (#28744) 2021-05-19 12:56:16 -04:00
providers_mirror_test.go providers subcommand tests (#28744) 2021-05-19 12:56:16 -04:00
providers_mirror.go add XTerraformGetLimit to prevent redirect loops 2022-06-01 12:46:22 -04:00
providers_schema_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
providers_schema.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
providers_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
providers.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
push.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
refresh_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
refresh.go command: mention plan options in refresh help text (#30892) 2022-05-31 14:27:21 +01:00
show_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
show.go cli: Migrate show command to use command arguments and views 2022-01-13 11:00:03 -06:00
state_command.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
state_list_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
state_list.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
state_meta.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
state_mv_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
state_mv.go cli: Make state commands check required version (#30511) 2022-03-31 13:42:42 -04:00
state_pull_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
state_pull.go cli: Make state commands check required version (#30511) 2022-03-31 13:42:42 -04:00
state_push_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
state_push.go cli: Make state commands check required version (#30511) 2022-03-31 13:42:42 -04:00
state_replace_provider_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
state_replace_provider.go cli: Make state commands check required version (#30511) 2022-03-31 13:42:42 -04:00
state_rm_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
state_rm.go cli: Make state commands check required version (#30511) 2022-03-31 13:42:42 -04:00
state_show_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
state_show.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
state_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
taint_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
taint.go cli: Make state commands check required version (#30511) 2022-03-31 13:42:42 -04:00
test_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
test.go command: make module installation interruptible 2021-11-11 12:28:10 +00:00
ui_input_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
ui_input.go command: Ensure all answers were used in command.testInputResponseMap 2021-09-21 22:26:16 -05:00
unlock_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
unlock.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
untaint_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
untaint.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
validate_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
validate.go core: Functional-style API for terraform.Context 2021-08-30 13:59:14 -07:00
version_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
version.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
workspace_command_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
workspace_command.go command/workspace_delete: Allow deleting a workspace with empty husks 2021-10-13 13:54:11 -07:00
workspace_delete.go Fix autocomplete for workspace subcommands 2022-01-08 14:41:20 +11:00
workspace_list.go Add cloud {} configuration block for Terraform Cloud 2021-10-28 19:29:09 -05:00
workspace_new.go Fix autocomplete for workspace subcommands 2022-01-08 14:41:20 +11:00
workspace_select.go Fix autocomplete for workspace subcommands 2022-01-08 14:41:20 +11:00
workspace_show.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00