terraform/internal
Martin Atkins 2cc94b4e89 core: terraform.Context with preloaded provider schemas
Loading schemas from some providers can be particularly expensive, since
providers for large remote platforms tend to have very large schemas.

Since provider schemas are needed for many operations in Terraform,
callers sometimes end up loading schemas themselves anyway. Earlier work
tried to mitigate this by introducing a global schema cache for all
plugin-based providers, but that's problematic because it forces only a
single implementation of each distinct provider source address across the
entire lifetime of a process importing package providers.

This does not remove that global cache yet, but does add a new capability
that will hopefully eventually supplant it: callers of
terraform.NewContext can provide a set of preloaded provider schemas which
they must ensure would match what Terraform Core would find if it loaded
the schemas from an instance of the same provider instantiated through
the corresponding factory function given alongside.

A caller that wishes to avoid the potential cost of multiple schema
lookups can now therefore go look up the schemas itself before calling
terraform.NewContext, and provide frozen schemas that we'll use instead
of fetching from the associated plugins.

As of this commit no callers are actually using this mechanism. The first
caller will be the "stackeval" package, which already loads provider
schemas in order to evaluate provider configuration blocks anyway and so
should always be able to provide a full complement of preloaded schemas
to avoid Terraform Core needing to do any further lookups itself.
2023-11-14 13:01:56 -08:00
..
addrs testing framework: implement overrides in terraform graph (#34169) 2023-11-10 10:07:04 +01:00
backend core: Context.Apply takes "opts" argument 2023-11-14 13:01:56 -08:00
builtin Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
checks Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
cloud Remove some redundant test cases for resolveCloudConfig 2023-10-06 17:24:05 -07:00
cloudplugin cloudplugin: change manifest format to match releases API 2023-09-06 14:03:24 -06:00
command terraform test: connect mock behaviour to test framework (#34205) 2023-11-14 08:50:37 +01:00
communicator Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
configs terraform test: implement the source attribute for mock providers (#34192) 2023-11-14 09:41:05 +01:00
copy Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
dag Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
depsfile Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
didyoumean Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
e2e Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
experiments Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
genconfig add missing copyright headers 2023-08-16 11:21:49 -07:00
getmodules Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
getproviders ignore expired provider signing keys 2023-10-06 11:00:11 -04:00
grpcwrap internal/grpcwrap: Ensure GetProviderSchemaOptional server capability is passed through (#33742) 2023-08-24 15:28:51 -04:00
helper/slowmessage Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
httpclient Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
initwd terraform test: implement the source attribute for mock providers (#34192) 2023-11-14 09:41:05 +01:00
instances Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
ipaddr Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
lang testing framework: add support for functions in variables and providers (#34204) 2023-11-13 09:25:32 +01:00
legacy Fix mock provider ImportState data race (#33921) 2023-09-21 17:34:39 +01:00
logging Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
modsdir Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
moduledeps Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
moduletest moduletest/mocking: make object and map iteration deterministic (#34238) 2023-11-14 10:27:14 +01:00
plans testing framework: implement overrides in terraform graph (#34169) 2023-11-10 10:07:04 +01:00
plugin core: terraform.Context with preloaded provider schemas 2023-11-14 13:01:56 -08:00
plugin6 core: terraform.Context with preloaded provider schemas 2023-11-14 13:01:56 -08:00
provider-simple Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
provider-simple-v6 Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
provider-terraform/main Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
providercache Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
providers core: terraform.Context with preloaded provider schemas 2023-11-14 13:01:56 -08:00
provisioner-local-exec/main Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
provisioners Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
refactoring Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
registry Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
releaseauth cloudplugin: change manifest format to match releases API 2023-09-06 14:03:24 -06:00
repl Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
replacefile Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
states statefile: Ignore unknown check results on decode 2023-09-06 10:48:58 -04:00
terminal Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
terraform core: terraform.Context with preloaded provider schemas 2023-11-14 13:01:56 -08:00
tfdiags add missing copyright headers 2023-08-16 11:21:49 -07:00
tfplugin5 stick with go generate check instead 2023-08-30 14:25:49 -07:00
tfplugin6 stick with go generate check instead 2023-08-30 14:25:49 -07:00