terraform/command/testdata
Martin Atkins e70ab09bf1 command: new cache directory .terraform/providers for providers
Terraform v0.10 introduced .terraform/plugins as a cache directory for
automatically-installed plugins, Terraform v0.13 later reorganized the
directory structure inside but retained its purpose as a cache.

The local cache used to also serve as a record of specifically which
packages were selected in a particular working directory, with the intent
that a second run of "terraform init" would always select the same
packages again. That meant that in some sense it behaved a bit like a
local filesystem mirror directory, even though that wasn't its intended
purpose.

Due to some unfortunate miscommunications, somewhere a long the line we
published some documentation that _recommended_ using the cache directory
as if it were a filesystem mirror directory when working with Terraform
Cloud. That was really only working as an accident of implementation
details, and Terraform v0.14 is now going to break that because the source
of record for the currently-selected provider versions is now the
public-facing dependency lock file rather than the contents of an existing
local cache directory on disk.

After some consideration of how to move forward here, this commit
implements a compromise that tries to avoid silently doing anything
surprising while still giving useful guidance to folks who were previously
using the unsupported strategy. Specifically:

- The local cache directory will now be .terraform/providers rather than
  .terraform/plugins, because .terraform/plugins is effectively "poisoned"
  by the incorrect usage that we can't reliably distinguish from prior
  version correct usage.

- The .terraform/plugins directory is now the "legacy cache directory". It
  is intentionally _not_ now a filesystem mirror directory, because that
  would risk incorrectly interpreting providers automatically installed
  by Terraform v0.13 as if they were a local mirror, and thus upgrades
  and checksum fetches from the origin registry would be blocked.

- Because of the previous two points, someone who _was_ trying to use the
  legacy cache directory as a filesystem mirror would see installation
  fail for any providers they manually added to the legacy directory.

  To avoid leaving that user stumped as to what went wrong, there's a
  heuristic for the case where a non-official provider fails installation
  and yet we can see it in the legacy cache directory. If that heuristic
  matches then we'll produce a warning message hinting to move the
  provider under the terraform.d/plugins directory, which is a _correct_
  location for "bundled" provider plugins that belong only to a single
  configuration (as opposed to being installed globally on a system).

This does unfortunately mean that anyone who was following the
incorrectly-documented pattern will now encounter an error (and the
aforementioned warning hint) after upgrading to Terraform v0.14. This
seems like the safest compromise because Terraform can't automatically
infer the intent of files it finds in .terraform/plugins in order to
decide automatically how best to handle them.

The internals of the .terraform directory are always considered
implementation detail for a particular Terraform version and so switching
to a new directory for the _actual_ cache directory fits within our usual
set of guarantees, though it's definitely non-ideal in isolation but okay
when taken in the broader context of this problem, where the alternative
would be silent misbehavior when upgrading.
2020-10-14 07:53:41 -07:00
..
013upgrade-existing-versions-tf command: Change 0.13upgrade default to versions.tf 2020-05-07 15:45:48 -04:00
013upgrade-explicit-providers command/013upgrade: detect builtin terraform provider (#25215) 2020-06-11 14:10:47 -04:00
013upgrade-file-exists command: Change 0.13upgrade default to versions.tf 2020-05-07 15:45:48 -04:00
013upgrade-implicit-not-found command: Change 0.13upgrade default to versions.tf 2020-05-07 15:45:48 -04:00
013upgrade-implicit-providers command/013upgrade: detect builtin terraform provider (#25215) 2020-06-11 14:10:47 -04:00
013upgrade-multiple-blocks command: Fix 0.13upgrade bug with multiple blocks 2020-05-07 20:11:44 -04:00
013upgrade-multiple-files command: Change 0.13upgrade default to versions.tf 2020-05-07 15:45:48 -04:00
013upgrade-no-providers command: Rework 0.13upgrade sub-command 2020-05-07 11:38:55 -04:00
013upgrade-preserves-comments command: Fix 0.13upgrade to preserve more comments 2020-06-24 15:54:46 -04:00
013upgrade-provider-not-found command: Change 0.13upgrade default to versions.tf 2020-05-07 15:45:48 -04:00
013upgrade-provider-redirect command: Add redirect support to 0.13upgrade 2020-08-31 14:53:35 -04:00
013upgrade-provider-redirect-version-unavailable command: Add redirect support to 0.13upgrade 2020-08-31 14:53:35 -04:00
013upgrade-providers-with-source command: Change 0.13upgrade default to versions.tf 2020-05-07 15:45:48 -04:00
013upgrade-skipped-files command: Change 0.13upgrade default to versions.tf 2020-05-07 15:45:48 -04:00
013upgrade-submodule command: Change 0.13upgrade default to versions.tf 2020-05-07 15:45:48 -04:00
013upgrade-unsupported-version command: Check required_version before upgrading 2020-05-07 15:45:48 -04:00
apply
apply-config-invalid
apply-destroy-targeted
apply-error
apply-input
apply-input-partial
apply-plan-no-module
apply-sensitive-output
apply-shutdown
apply-terraform-env
apply-vars fix command tests 2020-08-07 14:13:57 -04:00
backend-change refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-change-multi-default-to-single refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-change-multi-to-multi refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-change-multi-to-no-default-with-default refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-change-multi-to-no-default-without-default refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-change-multi-to-single refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-change-single-to-single refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-changed-with-legacy refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-from-state command: use backend config from state when backend=false is used. (#23802) 2020-01-07 15:07:06 -05:00
backend-inmem-locked
backend-new
backend-new-interp
backend-new-legacy refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-new-migrate refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-new-migrate-existing refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-plan-backend-empty
backend-plan-backend-empty-config refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-plan-backend-match refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-plan-backend-mismatch refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-plan-legacy
backend-plan-legacy-data refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-plan-local
backend-plan-local-match refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-plan-local-mismatch-lineage refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-plan-local-newer refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-unchanged refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-unchanged-with-legacy refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-unset refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend-unset-with-legacy refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
empty
fmt command/fmt: Restore some opinionated behaviors 2020-09-28 09:04:03 -07:00
get
graph
import-missing-resource-config
import-module-input-variable terraform: Eval module call arguments for import 2020-08-17 17:14:12 -04:00
import-module-var-file reproduction test 2020-06-12 15:39:55 -04:00
import-provider
import-provider-aliased
import-provider-datasource command/import: attach references before validating provider (#22862) 2020-02-12 14:00:08 -05:00
import-provider-implicit
import-provider-invalid command: Fix stale lock when exiting early 2020-02-14 14:48:30 -05:00
import-provider-remote-state
import-provider-var
import-provider-var-default
import-provider-var-file
init
init-backend
init-backend-config-file command: Fix backend config override validation 2020-08-21 16:21:13 -04:00
init-backend-config-file-change
init-backend-config-kv
init-backend-empty
init-check-required-version terraform: Fix required version constraint diags 2020-08-18 09:35:32 -04:00
init-get
init-get-provider-detected-legacy command/init: Improve diags for legacy providers 2020-06-12 09:57:01 -04:00
init-get-provider-invalid-package command/init: Display provider validation errors 2020-07-07 15:20:20 -04:00
init-get-provider-legacy-from-state command: Better in-house provider install errors 2020-09-01 14:02:19 -04:00
init-get-provider-source command/init: Use full config for provider reqs 2020-05-25 16:50:12 -04:00
init-get-providers vendor: go get github.com/apparentlymart/go-versions@v1.0.0 2020-06-12 08:45:14 -07:00
init-internal
init-internal-invalid internal/providercache: Handle built-in providers 2020-04-06 09:24:23 -07:00
init-legacy-provider-cache command: new cache directory .terraform/providers for providers 2020-10-14 07:53:41 -07:00
init-legacy-rc
init-provider-lock-file
init-providers-lock
init-required-providers provider source tests: added test suite to exercise hyphenated providers (#24685) 2020-04-16 15:54:33 -04:00
inmem-backend
login-oauth-server command: Fix OAuth2 PKCE arguments 2020-05-05 09:58:48 -07:00
login-tfe-server Add token validation for manual terraform login 2020-02-04 17:24:25 -05:00
modules Support reading module outputs in terraform console (#24808) 2020-04-30 09:21:42 -04:00
parallelism
plan
plan-emptydiff
plan-invalid
plan-out-backend
plan-out-backend-legacy
plan-vars
providers command/providers: Show provider requirements tree 2020-06-09 14:21:53 -04:00
providers-schema command: Providers schema shows required_providers 2020-09-22 10:28:32 -04:00
push
push-backend-new
push-input
push-input-partial
push-no-remote
push-no-upload
push-tfvars
refresh
refresh-empty
refresh-output
refresh-unset-var
refresh-var
show
show-json update new outputs plan json 2020-10-12 17:29:45 -04:00
show-json-state Mildwonkey/last tests (#24553) 2020-04-06 09:24:23 -07:00
state-list-backend-custom addrs: embed Provider in AbsProviderConfig instead of Type 2020-02-13 15:32:58 -05:00
state-list-backend-default addrs: embed Provider in AbsProviderConfig instead of Type 2020-02-13 15:32:58 -05:00
state-pull-backend
state-push-bad-lineage refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
state-push-good
state-push-replace-match
state-push-serial-newer addrs: embed Provider in AbsProviderConfig instead of Type 2020-02-13 15:32:58 -05:00
state-push-serial-older
taint-check-required-version command: Taint should respect required_version 2020-09-22 17:33:09 -04:00
validate-invalid
validate-valid
variables Remove sensitive_variables experiment 2020-10-08 11:22:20 -04:00
empty-file
statelocker.go state: remove deprecated state package (#25490) 2020-08-11 11:43:01 -04:00