You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 30204ec
Browse filesBrowse the repository at this point in the historyBrowse files
command/cliconfig: Allow development overrides for providers
For normal provider installation we want to associate each provider with
a selected version number and find a suitable package for that version
that conforms to the official hashes for that release.
Those requirements are very onerous for a provider developer currently
testing a not-yet-released build, though. To allow for that case this new
CLI configuration feature allows overriding specific providers to refer
to give local filesystem directories.
Any provider overridden in this way is not subject to the usual
restrictions about selected versions or checksum conformance, and
activating an override won't cause any changes to the selections recorded
in the lock file because it's intended to be a temporary setting for one
developer only.
This is, in a sense, a spiritual successor of an old capability we had to
override specific plugins in the CLI configuration file. There were
some vestiges of that left in the main package and CLI config package
but nothing has actually been honoring them for several versions now and
so this commit removes them to avoid confusion with the new mechanism.
// We require dev_overrides to appear first if it's present,
215
+
// because dev_overrides effectively bypass the normal
216
+
// selection process for a particular provider altogether,
217
+
// and so they don't participate in the usual
218
+
// include/exclude arguments and priority ordering.
219
+
diags=diags.Append(tfdiags.Sourceless(
220
+
tfdiags.Error,
221
+
"Invalid provider_installation method block",
222
+
fmt.Sprintf("The dev_overrides block at at %s must appear before all other installation methods, because development overrides always have the highest priority.", methodBlock.Pos()),
223
+
))
224
+
continue
225
+
}
226
+
227
+
// The content of a dev_overrides block is a mapping from
228
+
// provider source addresses to local filesystem paths. To get
229
+
// our decoding started, we'll use the normal HCL decoder to
230
+
// populate a map of strings and then decode further from
231
+
// that.
232
+
varrawItemsmap[string]string
233
+
err:=hcl.DecodeObject(&rawItems, methodBody)
234
+
iferr!=nil {
235
+
diags=diags.Append(tfdiags.Sourceless(
236
+
tfdiags.Error,
237
+
"Invalid provider_installation method block",
238
+
fmt.Sprintf("Invalid %s block at %s: %s.", methodTypeStr, block.Pos(), err),
Copy file name to clipboardExpand all lines: command/meta.go
+18-10Lines changed: 18 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -50,10 +50,9 @@ type Meta struct {
50
50
// for some reason.
51
51
OriginalWorkingDirstring
52
52
53
-
Colorbool// True if output should be colored
54
-
GlobalPluginDirs []string// Additional paths to search for plugins
55
-
PluginOverrides*PluginOverrides// legacy overrides from .terraformrc file
56
-
Ui cli.Ui// Ui for output
53
+
Colorbool// True if output should be colored
54
+
GlobalPluginDirs []string// Additional paths to search for plugins
55
+
Ui cli.Ui// Ui for output
57
56
58
57
// ExtraHooks are extra hooks to add to the context.
59
58
ExtraHooks []terraform.Hook
@@ -104,7 +103,21 @@ type Meta struct {
104
103
// When this channel is closed, the command will be cancelled.
105
104
ShutdownCh<-chanstruct{}
106
105
107
-
// UnmanagedProviders are a set of providers that exist as processes predating Terraform, which Terraform should use but not worry about the lifecycle of.
106
+
// ProviderDevOverrides are providers where we ignore the lock file, the
107
+
// configured version constraints, and the local cache directory and just
108
+
// always use exactly the path specified. This is intended to allow
109
+
// provider developers to easily test local builds without worrying about
110
+
// what version number they might eventually be released as, or what
0 commit comments