terraform/configs
Alisdair McDiarmid 45671a354d configs: Fix provider lookup local name mismatch
When a resource has no `provider` argument specified, its provider is
derived from the implied provider type based on the resource type. For
example, a `boop_instance` resource has an implied provider local name
of `boop`. Correspondingly, its provider configuration is specified with
a `provider "boop"` block.

However, users can use the `required_providers` configuration to give a
different local name to a given provider than its defined type. For
example, a provider may be published at `foobar/beep`, but provide
resources such as `boop_instance`. The most convenient way to use this
provider is with a `required_providers` map:

terraform {
  required_providers {
    boop = {
      source = "foobar/beep"
    }
  }
}

Once that local name is defined, it is used for provider configuration
(a `provider "boop"` block, not `provider "beep"`). It should also be
used when looking up a resource's provider configuration or provider.

This commit fixes a bug with this edge case, where previously we were
looking up the local provider configuration block using the resource's
assigned provider type. Instead, if no provider argument is specified,
we should be using the implied provider type, as that is what binds the
resource to the local provider configuration.
2020-11-10 15:25:02 -05:00
..
configload configs: deprecate version argument inside provider configuration blocks (#26135) 2020-09-08 08:19:00 -04:00
configschema extended cache comments 2020-10-14 12:45:06 -04:00
hcl2shim core: Remove the last few HIL remnants 2020-09-02 15:53:33 -07:00
testdata configs: Experimental support for optional object type attributes 2020-10-12 10:12:28 -07:00
backend.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
compat_shim.go configs: Deprecate nested redundant interpolations 2020-09-22 13:40:08 -04:00
config.go command: Providers schema shows required_providers 2020-09-22 10:28:32 -04:00
config_build.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
config_build_test.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
config_test.go remove LegacyProvider (#26433) 2020-10-05 08:33:49 -04:00
depends_on.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
doc.go configs: Additional guidance in doc.go 2018-02-15 15:56:39 -08:00
experiments.go configs: Experimental support for optional object type attributes 2020-10-12 10:12:28 -07:00
experiments_test.go experiments: a mechanism for opt-in experimental language features 2019-12-10 09:27:05 -08:00
module.go Tiny typo in an error message 2020-07-17 11:09:45 -04:00
module_call.go configs: More interpolation-only expr deprecations 2020-09-02 16:36:47 -04:00
module_call_test.go allow depends_on in module call 2020-05-20 13:46:13 -04:00
module_merge.go Implement module merge for sensitive config 2020-09-30 17:25:54 -04:00
module_merge_body.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
module_merge_test.go Remove sensitive_variables experiment 2020-10-08 11:22:20 -04:00
module_test.go remove LegacyProvider (#26433) 2020-10-05 08:33:49 -04:00
named_values.go configs: Experimental support for optional object type attributes 2020-10-12 10:12:28 -07:00
named_values_test.go config/name_values: fix index out of range in looksLikeSentences 2020-06-05 13:29:43 +02:00
parser.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
parser_config.go configs: Simplify required_providers blocks 2020-04-24 13:44:08 -04:00
parser_config_dir.go fix diagnostics handling 2019-11-21 09:14:50 -05:00
parser_config_dir_test.go move IsEmptyDir to configs package 2019-07-18 13:07:10 -04:00
parser_config_test.go fix comment text 2020-02-13 20:46:48 -05:00
parser_test.go configs: deprecate version argument inside provider configuration blocks (#26135) 2020-09-08 08:19:00 -04:00
parser_values.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
parser_values_test.go configs: update values file invalid syntax test for new HCL behavior 2018-03-08 11:17:39 -08:00
provider.go configs: deprecate version argument inside provider configuration blocks (#26135) 2020-09-08 08:19:00 -04:00
provider_meta.go configs: require normalized provider local names (#24945) 2020-05-14 09:00:58 -04:00
provider_requirements.go configs: Error on invalid required_providers attrs 2020-09-09 11:52:47 -04:00
provider_requirements_test.go configs: Error on invalid required_providers attrs 2020-09-09 11:52:47 -04:00
provider_test.go configs: deprecate version argument inside provider configuration blocks (#26135) 2020-09-08 08:19:00 -04:00
provisioner.go Add deprecation warning for vendor provisioners 2020-08-26 10:46:04 -04:00
provisioneronfailure_string.go stringer: Regenerate files with latest version 2019-05-13 15:34:27 +01:00
provisionerwhen_string.go stringer: Regenerate files with latest version 2019-05-13 15:34:27 +01:00
resource.go configs: Fix provider lookup local name mismatch 2020-11-10 15:25:02 -05:00
synth_body.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
synth_body_test.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
util.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
variable_type_hint.go Version tools per Go convention under tools.go 2019-10-17 22:23:39 +02:00
variabletypehint_string.go stringer: Regenerate files with latest version 2019-05-13 15:34:27 +01:00
version_constraint.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00