cliconfig

package
v0.63.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserProviderDir

func UserProviderDir() (string, error)

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

func LoadUserConfig() (*Config, error)

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

func (cfg *Config) AddHost(name string, services map[string]string)

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) Clone added in v0.58.7

func (cfg *Config) Clone() *Config

func (*Config) Save

func (cfg *Config) Save(configPath string) error

Save marshalls and saves CLI config with the given config path.

type ConfigCredentials added in v0.58.7

type ConfigCredentials struct {
	Name  string `hcl:",label"`
	Token string `hcl:"token"`
}

ConfigCredentials is the structure of the "credentials" nested block within the CLI configuration.

type ConfigCredentialsHelper added in v0.58.7

type ConfigCredentialsHelper struct {
	Name string   `hcl:",label"`
	Args []string `hcl:"args"`
}

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 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"`
	Include *[]string `hcl:"include,optional"`
	Exclude *[]string `hcl:"exclude,optional"`
}

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 (*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"`
	Path    string    `hcl:"path,attr"`
	Include *[]string `hcl:"include,optional"`
	Exclude *[]string `hcl:"exclude,optional"`
}

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 (*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

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

type ProviderInstallationNetworkMirror added in v0.58.7

type ProviderInstallationNetworkMirror struct {
	Name    string    `hcl:",label"`
	URL     string    `hcl:"url,attr"`
	Include *[]string `hcl:"include,optional"`
	Exclude *[]string `hcl:"exclude,optional"`
}

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 (*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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL