@@ -427,9 +427,8 @@ func (c *InitCommand) getProviders(config *configs.Config, state *states.State,
427427 if moreDiags .HasErrors () {
428428 return false , true , diags
429429 }
430- stateReqs := make (getproviders.Requirements , 0 )
431430 if state != nil {
432- stateReqs = state .ProviderRequirements ()
431+ stateReqs : = state .ProviderRequirements ()
433432 reqs = reqs .Merge (stateReqs )
434433 }
435434
@@ -774,16 +773,6 @@ func (c *InitCommand) getProviders(config *configs.Config, state *states.State,
774773 return true , false , diags
775774}
776775
777- func (c * InitCommand ) populateProviderToReqs (reqs map [addrs.Provider ][]* configs.ModuleRequirements , node * configs.ModuleRequirements ) {
778- for fqn := range node .Requirements {
779- reqs [fqn ] = append (reqs [fqn ], node )
780- }
781-
782- for _ , child := range node .Children {
783- c .populateProviderToReqs (reqs , child )
784- }
785- }
786-
787776// backendConfigOverrideBody interprets the raw values of -backend-config
788777// arguments into a hcl Body that should override the backend settings given
789778// in the configuration.
@@ -1030,117 +1019,6 @@ changes, we recommend adding version constraints in a required_providers block
10301019in your configuration, with the constraint strings suggested below.
10311020`
10321021
1033- const errDiscoveryServiceUnreachable = `
1034- [reset][bold][red]Registry service unreachable.[reset][red]
1035-
1036- This may indicate a network issue, or an issue with the requested Terraform Registry.
1037- `
1038-
1039- const errProviderNotFound = `
1040- [reset][bold][red]Provider %[1]q not available for installation.[reset][red]
1041-
1042- A provider named %[1]q could not be found in the Terraform Registry.
1043-
1044- This may result from mistyping the provider name, or the given provider may
1045- be a third-party provider that cannot be installed automatically.
1046-
1047- In the latter case, the plugin must be installed manually by locating and
1048- downloading a suitable distribution package and placing the plugin's executable
1049- file in the following directory:
1050- %[2]s
1051-
1052- Terraform detects necessary plugins by inspecting the configuration and state.
1053- To view the provider versions requested by each module, run
1054- "terraform providers".
1055- `
1056-
1057- const errProviderVersionsUnsuitable = `
1058- [reset][bold][red]No provider %[1]q plugins meet the constraint %[2]q.[reset][red]
1059-
1060- The version constraint is derived from the "version" argument within the
1061- provider %[1]q block in configuration. Child modules may also apply
1062- provider version constraints. To view the provider versions requested by each
1063- module in the current configuration, run "terraform providers".
1064-
1065- To proceed, the version constraints for this provider must be relaxed by
1066- either adjusting or removing the "version" argument in the provider blocks
1067- throughout the configuration.
1068- `
1069-
1070- const errProviderIncompatible = `
1071- [reset][bold][red]No available provider %[1]q plugins are compatible with this Terraform version.[reset][red]
1072-
1073- From time to time, new Terraform major releases can change the requirements for
1074- plugins such that older plugins become incompatible.
1075-
1076- Terraform checked all of the plugin versions matching the given constraint:
1077- %[2]s
1078-
1079- Unfortunately, none of the suitable versions are compatible with this version
1080- of Terraform. If you have recently upgraded Terraform, it may be necessary to
1081- move to a newer major release of this provider. Alternatively, if you are
1082- attempting to upgrade the provider to a new major version you may need to
1083- also upgrade Terraform to support the new version.
1084-
1085- Consult the documentation for this provider for more information on
1086- compatibility between provider versions and Terraform versions.
1087- `
1088-
1089- const errProviderInstallError = `
1090- [reset][bold][red]Error installing provider %[1]q: %[2]s.[reset][red]
1091-
1092- Terraform analyses the configuration and state and automatically downloads
1093- plugins for the providers used. However, when attempting to download this
1094- plugin an unexpected error occurred.
1095-
1096- This may be caused if for some reason Terraform is unable to reach the
1097- plugin repository. The repository may be unreachable if access is blocked
1098- by a firewall.
1099-
1100- If automatic installation is not possible or desirable in your environment,
1101- you may alternatively manually install plugins by downloading a suitable
1102- distribution package and placing the plugin's executable file in the
1103- following directory:
1104- %[3]s
1105- `
1106-
1107- const errMissingProvidersNoInstall = `
1108- [reset][bold][red]Missing required providers.[reset][red]
1109-
1110- The following provider constraints are not met by the currently-installed
1111- provider plugins:
1112-
1113- %[1]s
1114- Terraform can automatically download and install plugins to meet the given
1115- constraints, but this step was skipped due to the use of -get-plugins=false
1116- and/or -plugin-dir on the command line.
1117-
1118- If automatic installation is not possible or desirable in your environment,
1119- you may manually install plugins by downloading a suitable distribution package
1120- and placing the plugin's executable file in one of the directories given in
1121- by -plugin-dir on the command line, or in the following directory if custom
1122- plugin directories are not set:
1123- %[2]s
1124- `
1125-
1126- const errChecksumVerification = `
1127- [reset][bold][red]Error verifying checksum for provider %[1]q[reset][red]
1128- The checksum for provider distribution from the Terraform Registry
1129- did not match the source. This may mean that the distributed files
1130- were changed after this version was released to the Registry.
1131- `
1132-
1133- const errSignatureVerification = `
1134- [reset][bold][red]Error:[reset][bold] Untrusted signing key for provider %[1]q[reset]
1135-
1136- This provider package is not signed with the HashiCorp signing key, and is
1137- therefore incompatible with Terraform v%[2]s.
1138-
1139- A later version of Terraform may have introduced other signing keys that would
1140- accept this provider. Alternatively, an earlier version of this provider may
1141- be compatible with Terraform v%[2]s.
1142- `
1143-
11441022// providerProtocolTooOld is a message sent to the CLI UI if the provider's
11451023// supported protocol versions are too old for the user's version of terraform,
11461024// but a newer version of the provider is compatible.
@@ -1171,20 +1049,3 @@ Alternatively, upgrade to the latest version of Terraform for compatibility with
11711049
11721050// No version of the provider is compatible.
11731051const errProviderVersionIncompatible = `No compatible versions of provider %s were found.`
1174-
1175- // Logic from internal/initwd/getter.go
1176- var localSourcePrefixes = []string {
1177- "./" ,
1178- "../" ,
1179- ".\\ " ,
1180- "..\\ " ,
1181- }
1182-
1183- func isLocalSourceAddr (addr string ) bool {
1184- for _ , prefix := range localSourcePrefixes {
1185- if strings .HasPrefix (addr , prefix ) {
1186- return true
1187- }
1188- }
1189- return false
1190- }
0 commit comments