Documentation
¶
Overview ¶
Package cliconfig has the types representing and the logic to load CLI-level configuration settings.
The CLI config is a small collection of settings that a user can override via some files in their home directory or, in some cases, via environment variables. The CLI config is not the same thing as a Terraform configuration written in the Terraform language; the logic for those lives in the top-level directory "configs".
Index ¶
Constants ¶
This section is empty.
Variables ¶
var PluginOverrides command.PluginOverrides
PluginOverrides are paths that override discovered plugins, set from the config file.
Functions ¶
func ConfigFile ¶
ConfigFile returns the default path to the configuration file.
On Unix-like systems this is the ".terraformrc" file in the home directory. On Windows, this is the "terraform.rc" file in the application data directory.
Types ¶
type Config ¶
type Config struct {
Providers map[string]string
Provisioners map[string]string
DisableCheckpoint bool `hcl:"disable_checkpoint"`
DisableCheckpointSignature bool `hcl:"disable_checkpoint_signature"`
// If set, enables local caching of plugins in this directory to
// avoid repeatedly re-downloading over the Internet.
PluginCacheDir string `hcl:"plugin_cache_dir"`
Hosts map[string]*ConfigHost `hcl:"host"`
Credentials map[string]map[string]interface{} `hcl:"credentials"`
CredentialsHelpers map[string]*ConfigCredentialsHelper `hcl:"credentials_helper"`
}
Config is the structure of the configuration for the Terraform CLI.
This is not the configuration for Terraform itself. That is in the "config" package.
var BuiltinConfig Config
BuiltinConfig is the built-in defaults for the configuration. These can be overridden by user configurations.
func EnvConfig ¶
func EnvConfig() *Config
EnvConfig returns a Config populated from environment variables.
Any values specified in this config should override those set in the configuration file.
func LoadConfig ¶
func LoadConfig() (*Config, tfdiags.Diagnostics)
LoadConfig reads the CLI configuration from the various filesystem locations and from the environment, returning a merged configuration along with any diagnostics (errors and warnings) encountered along the way.
func (*Config) Merge ¶
Merge merges two configurations and returns a third entirely new configuration with the two merged.
func (*Config) Validate ¶
func (c *Config) Validate() tfdiags.Diagnostics
Validate checks for errors in the configuration that cannot be detected just by HCL decoding, returning any problems as diagnostics.
On success, the returned diagnostics will return false from the HasErrors method. A non-nil diagnostics is not necessarily an error, since it may contain just warnings.
type ConfigCredentialsHelper ¶
type ConfigCredentialsHelper struct {
Args []string `hcl:"args"`
}
ConfigCredentialsHelper is the structure of the "credentials_helper" nested block within the CLI configuration.
type ConfigHost ¶
type ConfigHost struct {
Services map[string]interface{} `hcl:"services"`
}
ConfigHost is the structure of the "host" nested block within the CLI configuration, which can be used to override the default service host discovery behavior for a particular hostname.