config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultLogLevel is the default logging level.
	DefaultLogLevel = "WARN"

	// DefaultPort is the default port to use for api server.
	DefaultPort = 8558
)
View Source
const (
	// DefaultConsulAddress is the default address to connect with Consul
	DefaultConsulAddress = "localhost:8500"

	// DefaultConsulKVPath is the default Consul KV path to use for Sync
	// KV operations.
	DefaultConsulKVPath = "consul-terraform-sync/"
)
View Source
const (
	// DefaultTFBackendKVPath is the default KV path used for configuring the
	// default backend to use Consul KV.
	DefaultTFBackendKVPath = "consul-terraform-sync/terraform"

	// DefaultTFWorkingDir is the default location where Sync will use as the
	// working directory to manage infrastructure.
	DefaultTFWorkingDir = "sync-tasks"
)
View Source
const (
	// DefaultDialKeepAlive is the default amount of time to keep alive
	// connections.
	DefaultDialKeepAlive = 30 * time.Second

	// DefaultDialTimeout is the amount of time to attempt to dial before timing
	// out.
	DefaultDialTimeout = 30 * time.Second

	// DefaultIdleConnTimeout is the default connection timeout for idle
	// connections.
	DefaultIdleConnTimeout = 5 * time.Second

	// DefaultMaxIdleConns is the default number of maximum idle connections.
	DefaultMaxIdleConns = 0

	// DefaultMaxIdleConnsPerHost is the default number of maximum idle
	// connections per host.
	DefaultMaxIdleConnsPerHost = 100

	// DefaultTLSHandshakeTimeout is the amount of time to negotiate the TLS
	// handshake.
	DefaultTLSHandshakeTimeout = 10 * time.Second
)
View Source
const (
	// DefaultVaultRenewToken is the default value for if the Vault token should
	// be renewed.
	DefaultVaultRenewToken = true

	// DefaultVaultUnwrapToken is the default value for if the Vault token should
	// be unwrapped.
	DefaultVaultUnwrapToken = false
)
View Source
const (
	// DefaultSyslogFacility is the default facility to log to.
	DefaultSyslogFacility = "LOCAL0"
)
View Source
const (
	// DefaultTLSVerify is the default value for TLS verification.
	DefaultTLSVerify = true
)

Variables

View Source
var (
	DefaultBufferPeriodMin = time.Duration(5 * time.Second)
	DefaultBufferPeriodMax = time.Duration(4 * DefaultBufferPeriodMin)
)
View Source
var (
	// DefaultSyslogName is the default app name in syslog.
	DefaultSyslogName = version.Name
)

Functions

func Bool

func Bool(b bool) *bool

Bool returns a pointer to the given bool.

func BoolCopy

func BoolCopy(b *bool) *bool

BoolCopy returns a copy of the boolean pointer

func BoolPresent

func BoolPresent(b *bool) bool

BoolPresent returns a boolean indicating if the pointer is nil, or if the pointer is pointing to the zero value..

func BoolVal

func BoolVal(b *bool) bool

BoolVal returns the value of the boolean at the pointer, or false if the pointer is nil.

func DefaultTerraformBackend

func DefaultTerraformBackend(consul *ConsulConfig) (map[string]interface{}, error)

DefaultTerraformBackend returns the default configuration to Consul KV.

func Int

func Int(i int) *int

Int returns a pointer to the given int.

func IntCopy

func IntCopy(i *int) *int

IntCopy returns a copy of the int pointer

func IntVal

func IntVal(i *int) int

IntVal returns the value of the int at the pointer, or 0 if the pointer is nil.

func String

func String(s string) *string

String returns a pointer to the given string.

func StringCopy

func StringCopy(s *string) *string

StringCopy returns a copy of the string pointer

func StringPresent

func StringPresent(s *string) bool

StringPresent returns a boolean indicating if the pointer is nil, or if the pointer is pointing to the zero value.

func StringVal

func StringVal(s *string) string

StringVal returns the value of the string at the pointer, or "" if the pointer is nil.

func TimeDuration

func TimeDuration(t time.Duration) *time.Duration

TimeDuration returns a pointer to the given time.Duration.

func TimeDurationCopy

func TimeDurationCopy(t *time.Duration) *time.Duration

TimeDurationCopy returns a copy of the time.Duration pointer

func TimeDurationPresent

func TimeDurationPresent(t *time.Duration) bool

TimeDurationPresent returns a boolean indicating if the pointer is nil, or if the pointer is pointing to the zero value.

func TimeDurationVal

func TimeDurationVal(t *time.Duration) time.Duration

TimeDurationVal returns the value of the string at the pointer, or 0 if the pointer is nil.

Types

type AuthConfig

type AuthConfig struct {
	Enabled  *bool   `mapstructure:"enabled"`
	Username *string `mapstructure:"username"`
	Password *string `mapstructure:"password"`
}

AuthConfig is the HTTP basic authentication data.

func DefaultAuthConfig

func DefaultAuthConfig() *AuthConfig

DefaultAuthConfig is the default configuration.

func (*AuthConfig) Copy

func (c *AuthConfig) Copy() *AuthConfig

Copy returns a deep copy of this configuration.

func (*AuthConfig) Finalize

func (c *AuthConfig) Finalize()

Finalize ensures there no nil pointers.

func (*AuthConfig) GoString

func (c *AuthConfig) GoString() string

GoString defines the printable version of this struct. Sensitive information is redacted.

func (*AuthConfig) Merge

func (c *AuthConfig) Merge(o *AuthConfig) *AuthConfig

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

type BufferPeriodConfig

type BufferPeriodConfig struct {
	// Enabled determines if this buffer period is enabled.
	Enabled *bool `mapstructure:"enabled"`

	// Min and Max are the minimum and maximum time, respectively, to wait for
	// data changes before rendering a new template to disk.
	Min *time.Duration `mapstructure:"min"`
	Max *time.Duration `mapstructure:"max"`
}

BufferPeriodConfig is the min and max duration to buffer changes for tasks before executing.

func DefaultBufferPeriodConfig

func DefaultBufferPeriodConfig() *BufferPeriodConfig

DefaultBufferPeriodConfig is the global default configuration for all tasks.

func DefaultTaskBufferPeriodConfig

func DefaultTaskBufferPeriodConfig() *BufferPeriodConfig

DefaultTaskBufferPeriodConfig is the default configuration for a task.

func (*BufferPeriodConfig) Copy

Copy returns a deep copy of this configuration.

func (*BufferPeriodConfig) Finalize

func (c *BufferPeriodConfig) Finalize()

Finalize ensures there no nil pointers.

func (*BufferPeriodConfig) GoString

func (c *BufferPeriodConfig) GoString() string

GoString defines the printable version of this struct.

func (*BufferPeriodConfig) Merge

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*BufferPeriodConfig) Validate

func (c *BufferPeriodConfig) Validate() error

Validate validates the values and required options. This method is recommended to run after Finalize() to ensure the configuration is safe to proceed.

type CatalogServicesConditionConfig added in v0.2.0

type CatalogServicesConditionConfig struct {
	Regexp            *string           `mapstructure:"regexp"`
	SourceIncludesVar *bool             `mapstructure:"source_includes_var"`
	Datacenter        *string           `mapstructure:"datacenter"`
	Namespace         *string           `mapstructure:"namespace"`
	NodeMeta          map[string]string `mapstructure:"node_meta"`
}

CatalogServicesConditionConfig configures a condition configuration block of type 'catalog-services'. A catalog-services condition is triggered by that occur to services in the catalog-services api.

func (*CatalogServicesConditionConfig) Copy added in v0.2.0

Copy returns a deep copy of this configuration.

func (*CatalogServicesConditionConfig) Finalize added in v0.2.0

func (c *CatalogServicesConditionConfig) Finalize(services []string)

Finalize ensures there no nil pointers with the _exception_ of Regexp. There is a need to distinguish betweeen nil regex (unconfigured regex) and empty string regex ("" regex pattern) at Validate()

func (*CatalogServicesConditionConfig) GoString added in v0.2.0

func (c *CatalogServicesConditionConfig) GoString() string

GoString defines the printable version of this struct.

func (*CatalogServicesConditionConfig) Merge added in v0.2.0

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*CatalogServicesConditionConfig) Validate added in v0.2.0

func (c *CatalogServicesConditionConfig) Validate() error

Validate validates the values and required options. This method is recommended to run after Finalize() to ensure the configuration is safe to proceed. Note, it handles the possibility of nil Regexp value even after Finalize().

type ConditionConfig added in v0.2.0

type ConditionConfig interface {
	Copy() ConditionConfig
	Merge(ConditionConfig) ConditionConfig
	Finalize([]string)
	Validate() error
	GoString() string
}

ConditionConfig configures a condition on a task to define the condition on which to execute a task.

func DefaultConditionConfig added in v0.2.0

func DefaultConditionConfig() ConditionConfig

DefaultConditionConfig returns the default conditions which is an unconfigured 'services' type condition.

type Config

type Config struct {
	LogLevel   *string `mapstructure:"log_level"`
	ClientType *string `mapstructure:"client_type"`
	Port       *int    `mapstructure:"port"`

	Syslog             *SyslogConfig             `mapstructure:"syslog"`
	Consul             *ConsulConfig             `mapstructure:"consul"`
	Vault              *VaultConfig              `mapstructure:"vault"`
	Driver             *DriverConfig             `mapstructure:"driver"`
	Tasks              *TaskConfigs              `mapstructure:"task"`
	Services           *ServiceConfigs           `mapstructure:"service"`
	TerraformProviders *TerraformProviderConfigs `mapstructure:"terraform_provider"`
	BufferPeriod       *BufferPeriodConfig       `mapstructure:"buffer_period"`
}

Config is used to configure Sync

func BuildConfig

func BuildConfig(paths []string) (*Config, error)

BuildConfig builds a new Config object from the default configuration and the list of config files given and returns it after validation.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration struct

func (*Config) Copy

func (c *Config) Copy() *Config

Copy returns a deep copy of the current configuration. This is useful because the nested data structures may be shared.

func (*Config) Finalize

func (c *Config) Finalize()

Finalize ensures there no nil pointers.

func (*Config) GoString

func (c *Config) GoString() string

GoString defines the printable version of this struct.

func (*Config) Merge

func (c *Config) Merge(o *Config) *Config

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the values and nested values of the configuration struct

type ConsulConfig

type ConsulConfig struct {
	// Address is the address of the Consul server. It may be an IP or FQDN.
	Address *string `mapstructure:"address"`

	// Auth is the HTTP basic authentication for communicating with Consul.
	Auth *AuthConfig `mapstructure:"auth"`

	// KVNamespace is the optional namespace for Sync to use for Consul KV
	// queries and operations.
	KVNamespace *string `mapstructure:"kv_namespace"`

	// KVPath is the directory in the Consul KV store to use for storing run time
	// data
	KVPath *string `mapstructure:"kv_path"`

	// TLS indicates we should use a secure connection while talking to
	// Consul. This requires Consul to be configured to serve HTTPS.
	TLS *TLSConfig `mapstructure:"tls"`

	// Token is the token to communicate with Consul securely.
	Token *string `mapstructure:"token"`

	// Transport configures the low-level network connection details.
	Transport *TransportConfig `mapstructure:"transport"`
}

ConsulConfig is the configuration for Consul client.

func DefaultConsulConfig

func DefaultConsulConfig() *ConsulConfig

DefaultConsulConfig returns the default configuration struct

func (*ConsulConfig) Copy

func (c *ConsulConfig) Copy() *ConsulConfig

Copy returns a deep copy of this configuration.

func (*ConsulConfig) Env

func (c *ConsulConfig) Env() map[string]string

Env returns an environment map of supported Consul configuration

func (*ConsulConfig) Finalize

func (c *ConsulConfig) Finalize()

Finalize ensures there no nil pointers.

func (*ConsulConfig) GoString

func (c *ConsulConfig) GoString() string

GoString defines the printable version of this struct. Sensitive information is redacted.

func (*ConsulConfig) Merge

func (c *ConsulConfig) Merge(o *ConsulConfig) *ConsulConfig

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

type DriverConfig

type DriverConfig struct {
	Terraform *TerraformConfig `mapstructure:"terraform"`
	// contains filtered or unexported fields
}

DriverConfig is the configuration for the Sync driver used to execute infrastructure updates.

func DefaultDriverConfig

func DefaultDriverConfig() *DriverConfig

DefaultDriverConfig returns the default configuration struct.

func (*DriverConfig) Copy

func (c *DriverConfig) Copy() *DriverConfig

Copy returns a deep copy of this configuration.

func (*DriverConfig) Finalize

func (c *DriverConfig) Finalize()

Finalize ensures there no nil pointers.

func (*DriverConfig) GoString

func (c *DriverConfig) GoString() string

GoString defines the printable version of this struct.

func (*DriverConfig) Merge

func (c *DriverConfig) Merge(o *DriverConfig) *DriverConfig

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*DriverConfig) Validate

func (c *DriverConfig) Validate() error

Validate validates the values and nested values of the configuration struct.

type FlagAppendSliceValue

type FlagAppendSliceValue []string

FlagAppendSliceValue implements the flag.Value interface and allows multiple calls to the same variable to append a list.

func (*FlagAppendSliceValue) Set

func (s *FlagAppendSliceValue) Set(value string) error

func (*FlagAppendSliceValue) String

func (s *FlagAppendSliceValue) String() string

type ServiceConfig

type ServiceConfig struct {
	// Datacenter is the datacenter the service is deployed in.
	Datacenter *string `mapstricture:"datacenter"`

	// Description is the human readable text to describe the service.
	Description *string `mapstructure:"description"`

	// ID identifies the service for Sync. This is used to explicitly
	// identify the service config for a task to use.
	ID *string `mapstructure:"id"`

	// Name is the Consul logical name of the service (required).
	Name *string `mapstructure:"name"`

	// Namespace is the namespace of the service (Consul Enterprise only). If not
	// provided, the namespace will be inferred from the Sync ACL token, or
	// default to the `default` namespace.
	Namespace *string `mapstructure:"namespace"`

	// Tag is used to filter nodes based on the tag for the service.
	// Deprecated in favor of Filter.
	Tag *string `mapstructure:"tag"`

	// Filter is used to filter nodes based on a Consul compatible filter expression.
	Filter *string `mapstructure:"filter"`

	// CTSUserDefinedMeta is metadata added to a service automated by CTS for
	// network infrastructure automation.
	CTSUserDefinedMeta map[string]string `mapstructure:"cts_user_defined_meta"`
}

ServiceConfig defines the explicit configuration for Sync to monitor a service. This block may be specified multiple times to configure multiple services.

func (*ServiceConfig) Copy

func (c *ServiceConfig) Copy() *ServiceConfig

Copy returns a deep copy of this configuration.

func (*ServiceConfig) Finalize

func (c *ServiceConfig) Finalize()

Finalize ensures there no nil pointers.

func (*ServiceConfig) GoString

func (c *ServiceConfig) GoString() string

GoString defines the printable version of this struct. Sensitive information is redacted.

func (*ServiceConfig) Merge

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*ServiceConfig) Validate

func (c *ServiceConfig) Validate() error

Validate validates the values and nested values of the configuration struct

type ServiceConfigs

type ServiceConfigs []*ServiceConfig

ServiceConfigs is a collection of ServiceConfig

func DefaultServiceConfigs

func DefaultServiceConfigs() *ServiceConfigs

DefaultServiceConfigs returns a configuration that is populated with the default values.

func (*ServiceConfigs) CTSUserDefinedMeta

func (c *ServiceConfigs) CTSUserDefinedMeta(serviceList []string) ServicesMeta

CTSUserDefinedMeta generates a map of service name to user defined metadata from a list of service IDs or service names.

func (*ServiceConfigs) Copy

func (c *ServiceConfigs) Copy() *ServiceConfigs

Copy returns a deep copy of this configuration.

func (*ServiceConfigs) Finalize

func (c *ServiceConfigs) Finalize()

Finalize ensures the configuration has no nil pointers and sets default values.

func (*ServiceConfigs) GoString

func (c *ServiceConfigs) GoString() string

GoString defines the printable version of this struct.

func (*ServiceConfigs) Len

func (c *ServiceConfigs) Len() int

Len is a helper method to get the length of the underlying config list

func (*ServiceConfigs) Merge

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*ServiceConfigs) Validate

func (c *ServiceConfigs) Validate() error

Validate validates the values and nested values of the configuration struct

type ServicesConditionConfig added in v0.2.0

type ServicesConditionConfig struct{}

ServicesConditionConfig configures a condition configuration block of type 'services'. This is the default type of condition. A services condition is triggered when changes occur to the the task's services.

func (*ServicesConditionConfig) Copy added in v0.2.0

Copy returns a deep copy of this configuration.

func (*ServicesConditionConfig) Finalize added in v0.2.0

func (c *ServicesConditionConfig) Finalize(services []string)

Finalize ensures there no nil pointers.

func (*ServicesConditionConfig) GoString added in v0.2.0

func (c *ServicesConditionConfig) GoString() string

GoString defines the printable version of this struct.

func (*ServicesConditionConfig) Merge added in v0.2.0

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*ServicesConditionConfig) Validate added in v0.2.0

func (c *ServicesConditionConfig) Validate() error

Validate validates the values and required options. This method is recommended to run after Finalize() to ensure the configuration is safe to proceed.

type ServicesMeta added in v0.2.0

type ServicesMeta map[string]map[string]string

ServicesMeta is a useful type to abstract from the nested map of string which represents the user defined meta for each service a task monitors

type SyslogConfig

type SyslogConfig struct {
	Enabled  *bool   `mapstructure:"enabled"`
	Facility *string `mapstructure:"facility"`
	Name     *string `mapstructure:"name"`
}

SyslogConfig is the configuration for syslog.

func DefaultSyslogConfig

func DefaultSyslogConfig() *SyslogConfig

DefaultSyslogConfig returns the default configuration struct.

func (*SyslogConfig) Copy

func (c *SyslogConfig) Copy() *SyslogConfig

Copy returns a deep copy of this configuration.

func (*SyslogConfig) Finalize

func (c *SyslogConfig) Finalize()

Finalize ensures there no nil pointers.

func (*SyslogConfig) GoString

func (c *SyslogConfig) GoString() string

GoString defines the printable version of this struct.

func (*SyslogConfig) Merge

func (c *SyslogConfig) Merge(o *SyslogConfig) *SyslogConfig

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

type TLSConfig

type TLSConfig struct {
	CACert     *string `mapstructure:"ca_cert"`
	CAPath     *string `mapstructure:"ca_path"`
	Cert       *string `mapstructure:"cert"`
	Enabled    *bool   `mapstructure:"enabled"`
	Key        *string `mapstructure:"key"`
	ServerName *string `mapstructure:"server_name"`
	Verify     *bool   `mapstructure:"verify"`
}

TLSConfig is the configuration for TLS.

func DefaultTLSConfig

func DefaultTLSConfig() *TLSConfig

DefaultTLSConfig returns a configuration that is populated with the default values.

func (*TLSConfig) ConsulEnv

func (c *TLSConfig) ConsulEnv() map[string]string

ConsulEnv returns an environment map of the TLS configuration for Consul

func (*TLSConfig) Copy

func (c *TLSConfig) Copy() *TLSConfig

Copy returns a deep copy of this configuration.

func (*TLSConfig) Finalize

func (c *TLSConfig) Finalize()

Finalize ensures there no nil pointers.

func (*TLSConfig) GoString

func (c *TLSConfig) GoString() string

GoString defines the printable version of this struct.

func (*TLSConfig) Merge

func (c *TLSConfig) Merge(o *TLSConfig) *TLSConfig

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

type TaskConfig

type TaskConfig struct {
	// Description is a human readable text to describe the task.
	Description *string `mapstructure:"description"`

	// Name is the unique name of the task.
	Name *string `mapstructure:"name"`

	// Providers is the list of provider names the task is dependent on. This is
	// used to map provider configuration to the task.
	Providers []string `mapstructure:"providers"`

	// Services is the list of service IDs or logical service names the task
	// executes on. Sync monitors the Consul Catalog for changes to these
	// services and triggers the task to run. Any service value not explicitly
	// defined by a `service` block with a matching ID is assumed to be a logical
	// service name in the default namespace.
	Services []string `mapstructure:"services"`

	// Source is the location the driver uses to fetch dependencies. The source
	// format is dependent on the driver. For the Terraform driver, the source
	// is the module path (local or remote).
	Source *string `mapstructure:"source"`

	// VarFiles is a list of paths to files containing variables for the
	// task. For the Terraform driver, these are files ending in `.tfvars` and
	// are used as Terraform input variables passed as arguments to the Terraform
	// module. Variables are loaded in the same order as they appear in the order
	// of the files. Duplicate variables are overwritten with the later value.
	VarFiles []string `mapstructure:"variable_files"`

	// Version is the version of source the task will use. For the Terraform
	// driver, this is the module version. The latest version will be used as
	// the default if omitted.
	Version *string `mapstructure:"version"`

	// BufferPeriod configures per-task buffer timers.
	BufferPeriod *BufferPeriodConfig `mapstructure:"buffer_period"`

	// Enabled determines if the task is enabled or not. Enabled by default.
	// If not enabled, this task will not make any changes to resources.
	Enabled *bool `mapstructure:"enabled"`

	// Condition optionally configures a single run condition under which the
	// task will start executing
	Condition ConditionConfig `mapstructure:"condition"`
}

TaskConfig is the configuration for a Sync task. This block may be specified multiple times to configure multiple tasks.

func (*TaskConfig) Copy

func (c *TaskConfig) Copy() *TaskConfig

Copy returns a deep copy of this configuration.

func (*TaskConfig) Finalize

func (c *TaskConfig) Finalize()

Finalize ensures there no nil pointers.

func (*TaskConfig) GoString

func (c *TaskConfig) GoString() string

GoString defines the printable version of this struct. Sensitive information is redacted.

func (*TaskConfig) Merge

func (c *TaskConfig) Merge(o *TaskConfig) *TaskConfig

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*TaskConfig) Validate

func (c *TaskConfig) Validate() error

Validate validates the values and required options. This method is recommended to run after Finalize() to ensure the configuration is safe to proceed.

type TaskConfigs

type TaskConfigs []*TaskConfig

TaskConfigs is a collection of TaskConfig

func DefaultTaskConfigs

func DefaultTaskConfigs() *TaskConfigs

DefaultTaskConfigs returns a configuration that is populated with the default values.

func FilterTasks

func FilterTasks(tasks *TaskConfigs, names []string) (*TaskConfigs, error)

FilterTasks filters the task configurations by task name.

func (*TaskConfigs) Copy

func (c *TaskConfigs) Copy() *TaskConfigs

Copy returns a deep copy of this configuration.

func (*TaskConfigs) Finalize

func (c *TaskConfigs) Finalize()

Finalize ensures the configuration has no nil pointers and sets default values.

func (*TaskConfigs) GoString

func (c *TaskConfigs) GoString() string

GoString defines the printable version of this struct.

func (*TaskConfigs) Len

func (c *TaskConfigs) Len() int

Len is a helper method to get the length of the underlying config list

func (*TaskConfigs) Merge

func (c *TaskConfigs) Merge(o *TaskConfigs) *TaskConfigs

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*TaskConfigs) Validate

func (c *TaskConfigs) Validate() error

Validate validates the values and nested values of the configuration struct

type TerraformConfig

type TerraformConfig struct {
	Version           *string                `mapstructure:"version"`
	Log               *bool                  `mapstructure:"log"`
	PersistLog        *bool                  `mapstructure:"persist_log"`
	Path              *string                `mapstructure:"path"`
	WorkingDir        *string                `mapstructure:"working_dir"`
	Backend           map[string]interface{} `mapstructure:"backend"`
	RequiredProviders map[string]interface{} `mapstructure:"required_providers"`
}

TerraformConfig is the configuration for the Terraform driver.

func DefaultTerraformConfig

func DefaultTerraformConfig() *TerraformConfig

DefaultTerraformConfig returns the default configuration struct.

func (*TerraformConfig) Copy

func (c *TerraformConfig) Copy() *TerraformConfig

Copy returns a deep copy of this configuration.

func (*TerraformConfig) Finalize

func (c *TerraformConfig) Finalize(consul *ConsulConfig)

Finalize ensures there no nil pointers.

func (*TerraformConfig) GoString

func (c *TerraformConfig) GoString() string

GoString defines the printable version of this struct.

func (*TerraformConfig) IsConsulBackend

func (c *TerraformConfig) IsConsulBackend() bool

IsConsulBackend returns if the Terraform backend is using Consul KV for remote state store.

func (*TerraformConfig) Merge

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*TerraformConfig) Validate

func (c *TerraformConfig) Validate() error

Validate validates the values and nested values of the configuration struct

type TerraformProviderConfig

type TerraformProviderConfig map[string]interface{}

TerraformProviderConfig is a map representing the configuration for a single provider where the key is the name of provider and value is the configuration.

func (*TerraformProviderConfig) Validate

func (c *TerraformProviderConfig) Validate() error

Validate validates the values and nested values of the configuration struct.

type TerraformProviderConfigs

type TerraformProviderConfigs []*TerraformProviderConfig

TerraformProviderConfigs is an array of configuration for each provider.

func DefaultTerraformProviderConfigs

func DefaultTerraformProviderConfigs() *TerraformProviderConfigs

DefaultTerraformProviderConfigs returns a configuration that is populated with the default values.

func (*TerraformProviderConfigs) Copy

Copy returns a deep copy of this configuration.

func (*TerraformProviderConfigs) Finalize

func (c *TerraformProviderConfigs) Finalize()

Finalize ensures the configuration has no nil pointers and sets default values.

func (*TerraformProviderConfigs) GoString

func (c *TerraformProviderConfigs) GoString() string

GoString defines the printable version of this struct. Provider configuration is completely redacted since providers will have varying arguments containing secrets

func (*TerraformProviderConfigs) Len

func (c *TerraformProviderConfigs) Len() int

Len is a helper method to get the length of the underlying config list

func (*TerraformProviderConfigs) Merge

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

func (*TerraformProviderConfigs) Validate

func (c *TerraformProviderConfigs) Validate() error

Validate validates the values and nested values of the configuration struct

type TransportConfig

type TransportConfig struct {
	// DialKeepAlive is the amount of time for keep-alives.
	DialKeepAlive *time.Duration `mapstructure:"dial_keep_alive"`

	// DialTimeout is the amount of time to wait to establish a connection.
	DialTimeout *time.Duration `mapstructure:"dial_timeout"`

	// DisableKeepAlives determines if keep-alives should be used. Disabling this
	// significantly decreases performance.
	DisableKeepAlives *bool `mapstructure:"disable_keep_alives"`

	// IdleConnTimeout is the timeout for idle connections.
	IdleConnTimeout *time.Duration `mapstructure:"idle_conn_timeout"`

	// MaxIdleConns is the maximum number of total idle connections.
	MaxIdleConns *int `mapstructure:"max_idle_conns"`

	// MaxIdleConnsPerHost is the maximum number of idle connections per remote
	// host.
	//
	// The majority of connections are established with one host, the Consul agent.
	// To achieve the shortest latency between a Consul service update to a task
	// execution, configure the max_idle_conns_per_host to a number proportional to
	// the number of services in automation across all tasks.
	//
	// This value must be lower than the configured http_max_conns_per_client
	// for the Consul agent. Note that requests made by Terraform subprocesses
	// or any other process on the same host as Consul-Terraform-Sync will
	// contribute to the Consul agent http_max_conns_per_client.
	//
	// If max_idle_conns_per_host or the number of services in automation is greater
	// than the Consul agent limit, Consul-Terraform-Sync may error due to
	// connection limits (429).
	MaxIdleConnsPerHost *int `mapstructure:"max_idle_conns_per_host"`

	// TLSHandshakeTimeout is the amount of time to wait to complete the TLS
	// handshake.
	TLSHandshakeTimeout *time.Duration `mapstructure:"tls_handshake_timeout"`
}

TransportConfig is the configuration to tune low-level APIs for the interactions on the wire.

func DefaultTransportConfig

func DefaultTransportConfig() *TransportConfig

DefaultTransportConfig returns a configuration that is populated with the default values.

func (*TransportConfig) Copy

func (c *TransportConfig) Copy() *TransportConfig

Copy returns a deep copy of this configuration.

func (*TransportConfig) Finalize

func (c *TransportConfig) Finalize()

Finalize ensures there no nil pointers.

func (*TransportConfig) GoString

func (c *TransportConfig) GoString() string

GoString defines the printable version of this struct.

func (*TransportConfig) Merge

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

type VaultConfig

type VaultConfig struct {
	// Address is the URI to the Vault server.
	Address *string `mapstructure:"address"`

	// Enabled controls whether the Vault integration is active.
	Enabled *bool `mapstructure:"enabled"`

	// Namespace is the Vault namespace to use for reading/writing secrets. This can
	// also be set via the VAULT_NAMESPACE environment variable.
	Namespace *string `mapstructure:"namespace"`

	// RenewToken renews the Vault token.
	RenewToken *bool `mapstructure:"renew_token"`

	// TLS indicates we should use a secure connection while talking to Vault.
	TLS *TLSConfig `mapstructure:"tls"`

	// Token is the Vault token to communicate with for requests. It may be
	// a wrapped token or a real token. This can also be set via the VAULT_TOKEN
	// environment variable, or via the VaultAgentTokenFile.
	Token *string `mapstructure:"token" json:"-"`

	// VaultAgentTokenFile is the path of file that contains a Vault Agent token.
	// If vault_agent_token_file is specified:
	//   - Consul-Terraform-Sync will not try to renew the Vault token.
	VaultAgentTokenFile *string `mapstructure:"vault_agent_token_file" json:"-"`

	// Transport configures the low-level network connection details.
	Transport *TransportConfig `mapstructure:"transport"`

	// UnwrapToken unwraps the provided Vault token as a wrapped token.
	UnwrapToken *bool `mapstructure:"unwrap_token"`
	// contains filtered or unexported fields
}

VaultConfig is the configuration for connecting to a vault server.

func DefaultVaultConfig

func DefaultVaultConfig() *VaultConfig

DefaultVaultConfig returns a configuration that is populated with the default values.

func (*VaultConfig) Copy

func (c *VaultConfig) Copy() *VaultConfig

Copy returns a deep copy of this configuration.

func (*VaultConfig) Finalize

func (c *VaultConfig) Finalize()

Finalize ensures there no nil pointers.

func (*VaultConfig) GoString

func (c *VaultConfig) GoString() string

GoString defines the printable version of this struct.

func (*VaultConfig) Merge

func (c *VaultConfig) Merge(o *VaultConfig) *VaultConfig

Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence. Maps and slices are merged, most other values are overwritten. Complex structs define their own merge functionality.

Jump to

Keyboard shortcuts

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