From 45b54b6d3811189be4a08ce5c021845071d2b2f5 Mon Sep 17 00:00:00 2001 From: Tyler Kellen Date: Wed, 24 Apr 2024 22:36:31 +1000 Subject: [PATCH] do not hijack TF_VAR, use OCI for environment vars --- common/client.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/client.go b/common/client.go index 2ee83ae518..6ecc6f9c0a 100644 --- a/common/client.go +++ b/common/client.go @@ -319,11 +319,11 @@ func getHomeFolder() string { } // DefaultConfigProvider returns the default config provider. The default config provider -// will look for configurations in 3 places: file in $HOME/.oci/config, HOME/.obmcs/config and -// variables names starting with the string TF_VAR. If the same configuration is found in multiple -// places the provider will prefer the first one. -// If the config file is not placed in the default location, the environment variable -// OCI_CONFIG_FILE can provide the config file location. +// will look for configurations in 3 places: file in $HOME/.oci/config, HOME/.obmcs/config, +// and variables names starting with the string OCI_. If the same configuration is found in +// multiple places the provider will prefer the first one. If the config file is not placed +// in the default location, the environment variable OCI_CONFIG_FILE can provide the config +// file location. func DefaultConfigProvider() ConfigurationProvider { defaultConfigFile := getDefaultConfigFilePath() homeFolder := getHomeFolder() @@ -331,7 +331,7 @@ func DefaultConfigProvider() ConfigurationProvider { defaultFileProvider, _ := ConfigurationProviderFromFile(defaultConfigFile, "") secondaryFileProvider, _ := ConfigurationProviderFromFile(secondaryConfigFile, "") - environmentProvider := environmentConfigurationProvider{EnvironmentVariablePrefix: "TF_VAR"} + environmentProvider := environmentConfigurationProvider{EnvironmentVariablePrefix: "OCI"} provider, _ := ComposingConfigurationProvider([]ConfigurationProvider{defaultFileProvider, secondaryFileProvider, environmentProvider}) Debugf("Configuration provided by: %s", provider) @@ -393,8 +393,8 @@ func setRawPath(u *url.URL) error { } // CustomProfileConfigProvider returns the config provider of given profile. The custom profile config provider -// will look for configurations in 2 places: file in $HOME/.oci/config, and variables names starting with the -// string TF_VAR. If the same configuration is found in multiple places the provider will prefer the first one. +// will look for configurations in 2 places: file in $HOME/.oci/config and variables names starting with the +// string OCI. If the same configuration is found in multiple places the provider will prefer the first one. func CustomProfileConfigProvider(customConfigPath string, profile string) ConfigurationProvider { homeFolder := getHomeFolder() if customConfigPath == "" { @@ -402,7 +402,7 @@ func CustomProfileConfigProvider(customConfigPath string, profile string) Config } customFileProvider, _ := ConfigurationProviderFromFileWithProfile(customConfigPath, profile, "") defaultFileProvider, _ := ConfigurationProviderFromFileWithProfile(customConfigPath, "DEFAULT", "") - environmentProvider := environmentConfigurationProvider{EnvironmentVariablePrefix: "TF_VAR"} + environmentProvider := environmentConfigurationProvider{EnvironmentVariablePrefix: "OCI"} provider, _ := ComposingConfigurationProvider([]ConfigurationProvider{customFileProvider, defaultFileProvider, environmentProvider}) Debugf("Configuration provided by: %s", provider) return provider