Documentation ¶
Overview ¶
Package cliconfig provides methods to create an OpenTofu/Terraform CLI configuration file.
Index ¶
- func UserProviderDir() (string, error)
- type Config
- func (cfg *Config) AddHost(name string, services map[string]string)
- func (cfg *Config) AddProviderInstallationMethods(newMethods ...ProviderInstallationMethod)
- func (cfg *Config) Clone() *Config
- func (cfg *Config) CredentialsSource() *CredentialsSource
- func (cfg *Config) Save(configPath string) error
- type ConfigCredentials
- type ConfigCredentialsHelper
- type ConfigHost
- type CredentialsSource
- type ProviderInstallation
- type ProviderInstallationDirect
- func (method *ProviderInstallationDirect) AppendExclude(addrs []string)
- func (method *ProviderInstallationDirect) AppendInclude(addrs []string)
- func (method *ProviderInstallationDirect) Merge(with ProviderInstallationMethod) bool
- func (method *ProviderInstallationDirect) RemoveExclude(addrs []string)
- func (method *ProviderInstallationDirect) RemoveInclude(addrs []string)
- func (method *ProviderInstallationDirect) String() string
- type ProviderInstallationFilesystemMirror
- func (method *ProviderInstallationFilesystemMirror) AppendExclude(addrs []string)
- func (method *ProviderInstallationFilesystemMirror) AppendInclude(addrs []string)
- func (method *ProviderInstallationFilesystemMirror) Merge(with ProviderInstallationMethod) bool
- func (method *ProviderInstallationFilesystemMirror) RemoveExclude(addrs []string)
- func (method *ProviderInstallationFilesystemMirror) RemoveInclude(addrs []string)
- func (method *ProviderInstallationFilesystemMirror) String() string
- type ProviderInstallationMethod
- type ProviderInstallationMethods
- type ProviderInstallationNetworkMirror
- func (method *ProviderInstallationNetworkMirror) AppendExclude(addrs []string)
- func (method *ProviderInstallationNetworkMirror) AppendInclude(addrs []string)
- func (method *ProviderInstallationNetworkMirror) Merge(with ProviderInstallationMethod) bool
- func (method *ProviderInstallationNetworkMirror) RemoveExclude(addrs []string)
- func (method *ProviderInstallationNetworkMirror) RemoveInclude(addrs []string)
- func (method *ProviderInstallationNetworkMirror) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UserProviderDir ¶
Types ¶
type Config ¶
type Config struct { DisableCheckpoint bool `hcl:"disable_checkpoint"` DisableCheckpointSignature bool `hcl:"disable_checkpoint_signature"` Credentials []ConfigCredentials `hcl:"credentials,block"` CredentialsHelpers *ConfigCredentialsHelper `hcl:"credentials_helper,block"` PluginCacheDir string `hcl:"plugin_cache_dir"` Hosts []ConfigHost `hcl:"host,block"` ProviderInstallation *ProviderInstallation `hcl:"provider_installation,block"` }
Config provides methods to create a terraform [CLI config file](https://developer.hashicorp.com/terraform/cli/config/config-file). The main purpose of which is to create a local config that will inherit the default user CLI config and adding new sections to force Terraform to send requests through the Terragrunt Cache server and use the provider cache directory.
func LoadUserConfig ¶
LoadUserConfig loads the user configuration is read as raw data and stored at the top of the saved configuration file. The location of the default config is different for each OS https://developer.hashicorp.com/terraform/cli/config/config-file#locations
func (*Config) AddHost ¶
AddHost adds a host (officially undocumented), https://github.com/hashicorp/terraform/issues/28309 It gives us opportunity rewrite path to the remote registry and the most important thing is that it works smoothly with HTTP (without HTTPS)
host "registry.terraform.io" { services = { "providers.v1" = "http://localhost:5758/v1/providers/registry.terraform.io/", } }
func (*Config) AddProviderInstallationMethods ¶ added in v0.58.7
func (cfg *Config) AddProviderInstallationMethods(newMethods ...ProviderInstallationMethod)
func (*Config) CredentialsSource ¶ added in v0.64.2
func (cfg *Config) CredentialsSource() *CredentialsSource
CredentialsSource creates and returns a service credentials source whose behavior depends on which "credentials" if are present in the receiving config.
type ConfigCredentials ¶ added in v0.58.7
ConfigCredentials is the structure of the "credentials" nested block within the CLI configuration.
type ConfigCredentialsHelper ¶ added in v0.58.7
ConfigCredentialsHelper is the structure of the "credentials_helper" nested block within the CLI configuration.
type ConfigHost ¶ added in v0.58.2
type ConfigHost struct { Name string `hcl:",label"` Services map[string]string `hcl:"services,attr"` }
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.
type CredentialsSource ¶ added in v0.64.2
type CredentialsSource struct {
// contains filtered or unexported fields
}
func (*CredentialsSource) ForHost ¶ added in v0.64.2
func (s *CredentialsSource) ForHost(host svchost.Hostname) svcauth.HostCredentials
type ProviderInstallation ¶
type ProviderInstallation struct {
Methods ProviderInstallationMethods `hcl:",block"`
}
ProviderInstallation is the structure of the "provider_installation" nested block within the CLI configuration.
type ProviderInstallationDirect ¶
type ProviderInstallationDirect struct { Name string `hcl:",label" json:"Name"` Include *[]string `hcl:"include,optional" json:"Include"` Exclude *[]string `hcl:"exclude,optional" json:"Exclude"` }
func NewProviderInstallationDirect ¶
func NewProviderInstallationDirect(include, exclude []string) *ProviderInstallationDirect
func (*ProviderInstallationDirect) AppendExclude ¶ added in v0.58.7
func (method *ProviderInstallationDirect) AppendExclude(addrs []string)
func (*ProviderInstallationDirect) AppendInclude ¶ added in v0.63.3
func (method *ProviderInstallationDirect) AppendInclude(addrs []string)
func (*ProviderInstallationDirect) Merge ¶ added in v0.63.3
func (method *ProviderInstallationDirect) Merge(with ProviderInstallationMethod) bool
func (*ProviderInstallationDirect) RemoveExclude ¶ added in v0.63.3
func (method *ProviderInstallationDirect) RemoveExclude(addrs []string)
func (*ProviderInstallationDirect) RemoveInclude ¶ added in v0.63.6
func (method *ProviderInstallationDirect) RemoveInclude(addrs []string)
func (*ProviderInstallationDirect) String ¶ added in v0.63.3
func (method *ProviderInstallationDirect) String() string
type ProviderInstallationFilesystemMirror ¶
type ProviderInstallationFilesystemMirror struct { Name string `hcl:",label" json:"Name"` Path string `hcl:"path,attr" json:"Path"` Include *[]string `hcl:"include,optional" json:"Include"` Exclude *[]string `hcl:"exclude,optional" json:"Exclude"` }
func NewProviderInstallationFilesystemMirror ¶
func NewProviderInstallationFilesystemMirror(path string, include, exclude []string) *ProviderInstallationFilesystemMirror
func (*ProviderInstallationFilesystemMirror) AppendExclude ¶ added in v0.58.7
func (method *ProviderInstallationFilesystemMirror) AppendExclude(addrs []string)
func (*ProviderInstallationFilesystemMirror) AppendInclude ¶ added in v0.63.3
func (method *ProviderInstallationFilesystemMirror) AppendInclude(addrs []string)
func (*ProviderInstallationFilesystemMirror) Merge ¶ added in v0.63.3
func (method *ProviderInstallationFilesystemMirror) Merge(with ProviderInstallationMethod) bool
func (*ProviderInstallationFilesystemMirror) RemoveExclude ¶ added in v0.63.3
func (method *ProviderInstallationFilesystemMirror) RemoveExclude(addrs []string)
func (*ProviderInstallationFilesystemMirror) RemoveInclude ¶ added in v0.63.6
func (method *ProviderInstallationFilesystemMirror) RemoveInclude(addrs []string)
func (*ProviderInstallationFilesystemMirror) String ¶ added in v0.63.3
func (method *ProviderInstallationFilesystemMirror) String() string
type ProviderInstallationMethod ¶
type ProviderInstallationMethod interface { fmt.Stringer AppendInclude(addrs []string) AppendExclude(addrs []string) RemoveInclude(addrs []string) RemoveExclude(addrs []string) Merge(with ProviderInstallationMethod) bool }
ProviderInstallationMethod is an interface type representing the different installation path types and represents an installation method block inside a provider_installation block. The concrete implementations of this interface are:
ProviderInstallationDirect: install from the provider's origin registry ProviderInstallationFilesystemMirror: install from a local filesystem mirror
type ProviderInstallationMethods ¶ added in v0.63.3
type ProviderInstallationMethods []ProviderInstallationMethod
func (ProviderInstallationMethods) Merge ¶ added in v0.63.3
func (methods ProviderInstallationMethods) Merge(withMethods ...ProviderInstallationMethod) ProviderInstallationMethods
type ProviderInstallationNetworkMirror ¶ added in v0.58.7
type ProviderInstallationNetworkMirror struct { Name string `hcl:",label" json:"Name"` URL string `hcl:"url,attr" json:"URL"` Include *[]string `hcl:"include,optional" json:"Include"` Exclude *[]string `hcl:"exclude,optional" json:"Exclude"` }
func NewProviderInstallationNetworkMirror ¶ added in v0.58.7
func NewProviderInstallationNetworkMirror(url string, include, exclude []string) *ProviderInstallationNetworkMirror
func (*ProviderInstallationNetworkMirror) AppendExclude ¶ added in v0.58.7
func (method *ProviderInstallationNetworkMirror) AppendExclude(addrs []string)
func (*ProviderInstallationNetworkMirror) AppendInclude ¶ added in v0.63.3
func (method *ProviderInstallationNetworkMirror) AppendInclude(addrs []string)
func (*ProviderInstallationNetworkMirror) Merge ¶ added in v0.63.3
func (method *ProviderInstallationNetworkMirror) Merge(with ProviderInstallationMethod) bool
func (*ProviderInstallationNetworkMirror) RemoveExclude ¶ added in v0.63.3
func (method *ProviderInstallationNetworkMirror) RemoveExclude(addrs []string)
func (*ProviderInstallationNetworkMirror) RemoveInclude ¶ added in v0.63.6
func (method *ProviderInstallationNetworkMirror) RemoveInclude(addrs []string)
func (*ProviderInstallationNetworkMirror) String ¶ added in v0.63.3
func (method *ProviderInstallationNetworkMirror) String() string