mirror of
https://github.com/hashicorp/terraform.git
synced 2026-06-09 00:42:48 -04:00
Ensure environment variables are set when interpolating rawPath
This commit is contained in:
parent
302c6deddc
commit
b53db4ef14
1 changed files with 12 additions and 1 deletions
|
|
@ -254,7 +254,18 @@ func decodeProviderInstallationFromConfig(hclFile *hclast.File) ([]*ProviderInst
|
|||
))
|
||||
continue
|
||||
}
|
||||
interpolatedPath := os.ExpandEnv(rawPath)
|
||||
interpolatedPath := os.Expand(rawPath, func(envVarName string) string {
|
||||
if value, ok := os.LookupEnv(envVarName); ok {
|
||||
return value
|
||||
} else {
|
||||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
"Interpolated environment variable not set",
|
||||
fmt.Sprintf("The environment variable %s is not set or empty and can result in undesired behavior", envVarName),
|
||||
))
|
||||
return ""
|
||||
}
|
||||
})
|
||||
dirPath := filepath.Clean(interpolatedPath)
|
||||
devOverrides[addr] = getproviders.PackageLocalDir(dirPath)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue