-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improved plugin cache detection
- Loading branch information
1 parent
c4a4894
commit eec362e
Showing
4 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package terraform | ||
|
||
import ( | ||
"os" | ||
"strings" | ||
|
||
"github.com/hashicorp/terraform/command/cliconfig" | ||
) | ||
|
||
// IsPluginCacheUsed returns true if the terraform plugin cache dir is specified, https://developer.hashicorp.com/terraform/cli/config/config-file#provider-plugin-cache | ||
func IsPluginCacheUsed() bool { | ||
if strings.TrimSpace(os.Getenv("TF_PLUGIN_CACHE_DIR")) != "" { | ||
return true | ||
} | ||
|
||
cfg, _ := cliconfig.LoadConfig() | ||
return cfg.PluginCacheDir != "" | ||
} |