Documentation ¶
Index ¶
- Constants
- Variables
- func Bool(b bool) *bool
- func BoolCopy(b *bool) *bool
- func BoolPresent(b *bool) bool
- func BoolVal(b *bool) bool
- func DefaultTerraformBackend(consul *ConsulConfig) (map[string]interface{}, error)
- func Int(i int) *int
- func IntCopy(i *int) *int
- func IntVal(i *int) int
- func String(s string) *string
- func StringCopy(s *string) *string
- func StringPresent(s *string) bool
- func StringVal(s *string) string
- func TimeDuration(t time.Duration) *time.Duration
- func TimeDurationCopy(t *time.Duration) *time.Duration
- func TimeDurationVal(t *time.Duration) time.Duration
- type AuthConfig
- type BufferPeriodConfig
- type CTSTLSConfig
- type CatalogServicesConditionConfig
- func (c *CatalogServicesConditionConfig) Copy() MonitorConfig
- func (c *CatalogServicesConditionConfig) Finalize()
- func (c *CatalogServicesConditionConfig) GoString() string
- func (c *CatalogServicesConditionConfig) Merge(o MonitorConfig) MonitorConfig
- func (c *CatalogServicesConditionConfig) Validate() error
- type CatalogServicesMonitorConfig
- func (c *CatalogServicesMonitorConfig) Copy() MonitorConfig
- func (c *CatalogServicesMonitorConfig) Finalize()
- func (c *CatalogServicesMonitorConfig) GoString() string
- func (c *CatalogServicesMonitorConfig) Merge(o MonitorConfig) MonitorConfig
- func (c *CatalogServicesMonitorConfig) Validate() error
- func (c *CatalogServicesMonitorConfig) VariableType() string
- type ConditionConfig
- type Config
- type ConsulConfig
- type ConsulKVConditionConfig
- type ConsulKVModuleInputConfig
- type ConsulKVMonitorConfig
- func (c *ConsulKVMonitorConfig) Copy() MonitorConfig
- func (c *ConsulKVMonitorConfig) Finalize()
- func (c *ConsulKVMonitorConfig) GoString() string
- func (c *ConsulKVMonitorConfig) Merge(o MonitorConfig) MonitorConfig
- func (c *ConsulKVMonitorConfig) Validate() error
- func (c *ConsulKVMonitorConfig) VariableType() string
- type DefaultCheckConfig
- type DriverConfig
- type FlagAppendSliceValue
- type ModuleInputConfig
- type ModuleInputConfigs
- func (c *ModuleInputConfigs) Copy() *ModuleInputConfigs
- func (c *ModuleInputConfigs) Finalize()
- func (c *ModuleInputConfigs) GoString() string
- func (c *ModuleInputConfigs) Len() int
- func (c *ModuleInputConfigs) Merge(o *ModuleInputConfigs) *ModuleInputConfigs
- func (c *ModuleInputConfigs) Validate(services []string, condition ConditionConfig) error
- type MonitorConfig
- type NoConditionConfig
- type NoConditionMonitorConfig
- type ScheduleConditionConfig
- func (c *ScheduleConditionConfig) Copy() MonitorConfig
- func (c *ScheduleConditionConfig) Finalize()
- func (c *ScheduleConditionConfig) GoString() string
- func (c *ScheduleConditionConfig) Merge(o MonitorConfig) MonitorConfig
- func (c *ScheduleConditionConfig) Validate() error
- func (c *ScheduleConditionConfig) VariableType() string
- type ScheduleMonitorConfig
- type ServiceConfig
- type ServiceConfigs
- func (c *ServiceConfigs) CTSUserDefinedMeta(serviceList []string) ServicesMeta
- func (c *ServiceConfigs) Copy() *ServiceConfigs
- func (c *ServiceConfigs) Finalize()
- func (c *ServiceConfigs) GoString() string
- func (c *ServiceConfigs) Len() int
- func (c *ServiceConfigs) Merge(o *ServiceConfigs) *ServiceConfigs
- func (c *ServiceConfigs) Validate() error
- type ServiceRegistrationConfig
- func (c *ServiceRegistrationConfig) Copy() *ServiceRegistrationConfig
- func (c *ServiceRegistrationConfig) Finalize()
- func (c *ServiceRegistrationConfig) GoString() string
- func (c *ServiceRegistrationConfig) Merge(o *ServiceRegistrationConfig) *ServiceRegistrationConfig
- func (c *ServiceRegistrationConfig) Validate() error
- type ServicesConditionConfig
- type ServicesMeta
- type ServicesModuleInputConfig
- type ServicesMonitorConfig
- func (c *ServicesMonitorConfig) Copy() MonitorConfig
- func (c *ServicesMonitorConfig) Finalize()
- func (c *ServicesMonitorConfig) GoString() string
- func (c *ServicesMonitorConfig) Merge(o MonitorConfig) MonitorConfig
- func (c *ServicesMonitorConfig) Validate() error
- func (c *ServicesMonitorConfig) VariableType() string
- type SyslogConfig
- type TLSConfig
- type TaskConfig
- func (c *TaskConfig) Copy() *TaskConfig
- func (c *TaskConfig) Finalize() error
- func (c *TaskConfig) GoString() string
- func (c *TaskConfig) InheritParentConfig(parentWorkDir string, parentBufferPeriod BufferPeriodConfig) *TaskConfig
- func (c *TaskConfig) Merge(o *TaskConfig) *TaskConfig
- func (c *TaskConfig) SetVariables() error
- func (c *TaskConfig) Validate() error
- func (c *TaskConfig) ValidateForDriver() error
- type TaskConfigs
- type TerraformCloudWorkspaceConfig
- func (c *TerraformCloudWorkspaceConfig) Copy() *TerraformCloudWorkspaceConfig
- func (c *TerraformCloudWorkspaceConfig) Finalize()
- func (c *TerraformCloudWorkspaceConfig) GoString() string
- func (c *TerraformCloudWorkspaceConfig) IsEmpty() bool
- func (c *TerraformCloudWorkspaceConfig) Merge(o *TerraformCloudWorkspaceConfig) *TerraformCloudWorkspaceConfig
- func (c *TerraformCloudWorkspaceConfig) Validate() error
- type TerraformConfig
- func (c *TerraformConfig) Copy() *TerraformConfig
- func (c *TerraformConfig) Finalize(consul *ConsulConfig)
- func (c *TerraformConfig) GoString() string
- func (c *TerraformConfig) IsConsulBackend() bool
- func (c *TerraformConfig) Merge(o *TerraformConfig) *TerraformConfig
- func (c *TerraformConfig) Validate() error
- type TerraformProviderConfig
- type TerraformProviderConfigs
- func (c *TerraformProviderConfigs) Copy() *TerraformProviderConfigs
- func (c *TerraformProviderConfigs) Finalize()
- func (c *TerraformProviderConfigs) GoString() string
- func (c *TerraformProviderConfigs) Len() int
- func (c *TerraformProviderConfigs) Merge(o *TerraformProviderConfigs) *TerraformProviderConfigs
- func (c *TerraformProviderConfigs) Validate() error
- type TransportConfig
- type VaultConfig
Constants ¶
const ( // DefaultLogLevel is the default logging level. DefaultLogLevel = "INFO" // DefaultPort is the default port to use for api server. DefaultPort = 8558 // DefaultWorkingDir is the default location where CTS will manage // artifacts generated for each task. By default, a child directory is // created for each task with its task name. DefaultWorkingDir = "sync-tasks" )
const ( // DefaultConsulAddress is the default address to connect with Consul DefaultConsulAddress = "localhost:8500" // DefaultConsulKVPath is the default Consul KV path to use for CTS // KV operations. DefaultConsulKVPath = "consul-terraform-sync/" )
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 )
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 )
const (
DefaultMutualTLSVerify = false
)
const (
DefaultServiceName = "consul-terraform-sync"
)
const (
// DefaultSyslogFacility is the default facility to log to.
DefaultSyslogFacility = "LOCAL0"
)
const (
DefaultTFBackendKVPath = "consul-terraform-sync/terraform"
)
DefaultTFBackendKVPath is the default KV path used for configuring the default backend to use Consul KV.
const ( // DefaultTLSVerify is the default value for TLS verification. DefaultTLSVerify = true )
Variables ¶
var ( DefaultBufferPeriodMin = 5 * time.Second DefaultBufferPeriodMax = 4 * DefaultBufferPeriodMin )
var ( DecodeJsonHook = mapstructure.ComposeDecodeHookFunc( conditionToTypeFunc(), moduleInputToTypeFunc(), mapstructure.StringToTimeDurationHookFunc(), decode.HookTranslateKeys, ) DecodeHclHook = mapstructure.ComposeDecodeHookFunc( conditionToTypeFunc(), moduleInputToTypeFunc(), decode.HookWeakDecodeFromSlice, mapstructure.StringToTimeDurationHookFunc(), decode.HookTranslateKeys) )
var ( // DefaultSyslogName is the default app name in syslog. DefaultSyslogName = version.Name )
Functions ¶
func BoolPresent ¶
BoolPresent returns a boolean indicating if the pointer is nil, or if the pointer is pointing to the zero value.
func BoolVal ¶
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 StringCopy ¶
StringCopy returns a copy of the string pointer
func StringPresent ¶
StringPresent returns a boolean indicating if the pointer is nil, or if the pointer is pointing to the zero value.
func StringVal ¶
StringVal returns the value of the string at the pointer, or "" if the pointer is nil.
func TimeDuration ¶
TimeDuration returns a pointer to the given time.Duration.
func TimeDurationCopy ¶
TimeDurationCopy returns a copy of the time.Duration pointer
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" json:"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" json:"min"` Max *time.Duration `mapstructure:"max" json:"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 (*BufferPeriodConfig) Copy ¶
func (c *BufferPeriodConfig) Copy() *BufferPeriodConfig
Copy returns a deep copy of this configuration.
func (*BufferPeriodConfig) Finalize ¶
func (c *BufferPeriodConfig) Finalize()
Finalize ensures that the receiver contains no nil pointers. For nil pointers, Finalize sets default values where necessary
func (*BufferPeriodConfig) GoString ¶
func (c *BufferPeriodConfig) GoString() string
GoString defines the printable version of this struct.
func (*BufferPeriodConfig) Merge ¶
func (c *BufferPeriodConfig) Merge(o *BufferPeriodConfig) *BufferPeriodConfig
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 CTSTLSConfig ¶ added in v0.4.2
type CTSTLSConfig struct { Enabled *bool `mapstructure:"enabled"` Cert *string `mapstructure:"cert"` Key *string `mapstructure:"key"` VerifyIncoming *bool `mapstructure:"verify_incoming"` CACert *string `mapstructure:"ca_cert"` CAPath *string `mapstructure:"ca_path"` }
CTSTLSConfig is the configuration for TLS and mutual TLS on the CTS API.
func DefaultCTSTLSConfig ¶ added in v0.4.2
func DefaultCTSTLSConfig() *CTSTLSConfig
DefaultCTSTLSConfig returns a configuration that is populated with the default values.
func (*CTSTLSConfig) Copy ¶ added in v0.4.2
func (c *CTSTLSConfig) Copy() *CTSTLSConfig
Copy returns a deep copy of this configuration.
func (*CTSTLSConfig) Finalize ¶ added in v0.4.2
func (c *CTSTLSConfig) Finalize()
Finalize ensures there no nil pointers.
func (*CTSTLSConfig) GoString ¶ added in v0.4.2
func (c *CTSTLSConfig) GoString() string
GoString defines the printable version of this struct.
func (*CTSTLSConfig) Merge ¶ added in v0.4.2
func (c *CTSTLSConfig) Merge(o *CTSTLSConfig) *CTSTLSConfig
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 (*CTSTLSConfig) Validate ¶ added in v0.4.2
func (c *CTSTLSConfig) Validate() error
Validate validates TLS configuration for serving the CTS API
type CatalogServicesConditionConfig ¶ added in v0.2.0
type CatalogServicesConditionConfig struct {
CatalogServicesMonitorConfig `mapstructure:",squash" json:"catalog-services"`
}
CatalogServicesConditionConfig configures a condition configuration block of type 'catalog-services'. A catalog-services condition is triggered by changes that occur to services in the catalog-services api.
func (*CatalogServicesConditionConfig) Copy ¶ added in v0.2.0
func (c *CatalogServicesConditionConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*CatalogServicesConditionConfig) Finalize ¶ added in v0.2.0
func (c *CatalogServicesConditionConfig) Finalize()
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
func (c *CatalogServicesConditionConfig) Merge(o MonitorConfig) MonitorConfig
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 CatalogServicesMonitorConfig ¶ added in v0.4.0
type CatalogServicesMonitorConfig struct { Regexp *string `mapstructure:"regexp" json:"regexp"` Datacenter *string `mapstructure:"datacenter" json:"datacenter"` Namespace *string `mapstructure:"namespace" json:"namespace"` NodeMeta map[string]string `mapstructure:"node_meta" json:"node_meta"` // UseAsModuleInput was previously named SourceIncludesVar - deprecated v0.5 UseAsModuleInput *bool `mapstructure:"use_as_module_input" json:"use_as_module_input"` DeprecatedSourceIncludesVar *bool `mapstructure:"source_includes_var" json:"source_includes_var"` }
CatalogServicesMonitorConfig configures a configuration block adhering to the monitor interface of type 'catalog-services'. A catalog-services monitor is triggered by changes that occur to services in the catalog-services api.
func (*CatalogServicesMonitorConfig) Copy ¶ added in v0.4.0
func (c *CatalogServicesMonitorConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*CatalogServicesMonitorConfig) Finalize ¶ added in v0.4.0
func (c *CatalogServicesMonitorConfig) Finalize()
Finalize ensures there no nil pointers with the _exception_ of Regexp. There is a need to distinguish between nil regex (unconfigured regex) and empty string regex ("" regex pattern) at Validate()
func (*CatalogServicesMonitorConfig) GoString ¶ added in v0.4.0
func (c *CatalogServicesMonitorConfig) GoString() string
GoString defines the printable version of this struct.
func (*CatalogServicesMonitorConfig) Merge ¶ added in v0.4.0
func (c *CatalogServicesMonitorConfig) Merge(o MonitorConfig) MonitorConfig
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 (*CatalogServicesMonitorConfig) Validate ¶ added in v0.4.0
func (c *CatalogServicesMonitorConfig) 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().
func (*CatalogServicesMonitorConfig) VariableType ¶ added in v0.5.0
func (c *CatalogServicesMonitorConfig) VariableType() string
type ConditionConfig ¶ added in v0.2.0
type ConditionConfig interface { MonitorConfig }
ConditionConfig configures a condition on a task. This Condition defines what to monitor for in order to trigger the execution of a task
func EmptyConditionConfig ¶ added in v0.5.0
func EmptyConditionConfig() ConditionConfig
EmptyConditionConfig sets an unconfigured condition with a non-null value
type Config ¶
type Config struct { LogLevel *string `mapstructure:"log_level"` ClientType *string `mapstructure:"client_type"` Port *int `mapstructure:"port"` WorkingDir *string `mapstructure:"working_dir"` ID *string `mapstructure:"id"` Syslog *SyslogConfig `mapstructure:"syslog"` Consul *ConsulConfig `mapstructure:"consul"` Vault *VaultConfig `mapstructure:"vault"` Driver *DriverConfig `mapstructure:"driver"` Tasks *TaskConfigs `mapstructure:"task"` DeprecatedServices *ServiceConfigs `mapstructure:"service"` TerraformProviders *TerraformProviderConfigs `mapstructure:"terraform_provider"` BufferPeriod *BufferPeriodConfig `mapstructure:"buffer_period"` TLS *CTSTLSConfig `mapstructure:"tls"` }
Config is used to configure CTS
func BuildConfig ¶
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 ¶
Copy returns a deep copy of the current configuration. This is useful because the nested data structures may be shared.
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 CTS 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"` // ServiceRegistration configures registering CTS as a service with Consul ServiceRegistration *ServiceRegistrationConfig `mapstructure:"service_registration"` }
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.
func (*ConsulConfig) Validate ¶ added in v0.6.0
func (c *ConsulConfig) 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 ConsulKVConditionConfig ¶ added in v0.4.0
type ConsulKVConditionConfig struct { ConsulKVMonitorConfig `mapstructure:",squash" json:"consul-kv"` // UseAsModuleInput was previously named SourceIncludesVar - deprecated v0.5 UseAsModuleInput *bool `mapstructure:"use_as_module_input" json:"use_as_module_input"` DeprecatedSourceIncludesVar *bool `mapstructure:"source_includes_var" json:"source_includes_var"` }
ConsulKVConditionConfig configures a condition configuration block of type 'consul-kv'. A consul-kv condition is triggered by changes that occur to consul key-values.
func (*ConsulKVConditionConfig) Copy ¶ added in v0.4.0
func (c *ConsulKVConditionConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*ConsulKVConditionConfig) Finalize ¶ added in v0.4.0
func (c *ConsulKVConditionConfig) Finalize()
Finalize ensures there no nil pointers.
func (*ConsulKVConditionConfig) GoString ¶ added in v0.4.0
func (c *ConsulKVConditionConfig) GoString() string
GoString defines the printable version of this struct.
func (*ConsulKVConditionConfig) Merge ¶ added in v0.4.0
func (c *ConsulKVConditionConfig) Merge(o MonitorConfig) MonitorConfig
Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence.
func (*ConsulKVConditionConfig) Validate ¶ added in v0.4.0
func (c *ConsulKVConditionConfig) 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 ConsulKVModuleInputConfig ¶ added in v0.5.0
type ConsulKVModuleInputConfig struct {
ConsulKVMonitorConfig `mapstructure:",squash" json:"consul-kv"`
}
ConsulKVModuleInputConfig configures a module_input configuration block of type 'consul-kv'. The consul key-values will be used as input for the module variables.
func (*ConsulKVModuleInputConfig) Copy ¶ added in v0.5.0
func (c *ConsulKVModuleInputConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*ConsulKVModuleInputConfig) Finalize ¶ added in v0.5.0
func (c *ConsulKVModuleInputConfig) Finalize()
Finalize ensures there are no nil pointers.
func (*ConsulKVModuleInputConfig) GoString ¶ added in v0.5.0
func (c *ConsulKVModuleInputConfig) GoString() string
GoString defines the printable version of this struct.
func (*ConsulKVModuleInputConfig) Merge ¶ added in v0.5.0
func (c *ConsulKVModuleInputConfig) Merge(o MonitorConfig) MonitorConfig
Merge combines all values in this configuration `c` with the values in the other configuration `o`, 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 (*ConsulKVModuleInputConfig) Validate ¶ added in v0.5.0
func (c *ConsulKVModuleInputConfig) 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 ConsulKVMonitorConfig ¶ added in v0.4.0
type ConsulKVMonitorConfig struct { Path *string `mapstructure:"path" json:"path"` Recurse *bool `mapstructure:"recurse" json:"recurse"` Datacenter *string `mapstructure:"datacenter" json:"datacenter"` Namespace *string `mapstructure:"namespace" json:"namespace"` }
ConsulKVMonitorConfig configures a configuration block adhering to the monitor interface of type 'consul-kv'. A consul-kv monitor watches for changes that occur in the consul kv.
func (*ConsulKVMonitorConfig) Copy ¶ added in v0.4.0
func (c *ConsulKVMonitorConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*ConsulKVMonitorConfig) Finalize ¶ added in v0.4.0
func (c *ConsulKVMonitorConfig) Finalize()
Finalize ensures there no nil pointers.
func (*ConsulKVMonitorConfig) GoString ¶ added in v0.4.0
func (c *ConsulKVMonitorConfig) GoString() string
GoString defines the printable version of this struct.
func (*ConsulKVMonitorConfig) Merge ¶ added in v0.4.0
func (c *ConsulKVMonitorConfig) Merge(o MonitorConfig) MonitorConfig
Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence.
func (*ConsulKVMonitorConfig) Validate ¶ added in v0.4.0
func (c *ConsulKVMonitorConfig) 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.
func (*ConsulKVMonitorConfig) VariableType ¶ added in v0.5.0
func (c *ConsulKVMonitorConfig) VariableType() string
type DefaultCheckConfig ¶ added in v0.6.0
type DefaultCheckConfig struct { Enabled *bool `mapstructure:"enabled"` Address *string `mapstructure:"address"` }
DefaultCheckConfig is a configuration that controls whether to create a default health check on the CTS service in Consul. It also allows for some modification of the health check to account for different setups of CTS.
func (*DefaultCheckConfig) Copy ¶ added in v0.6.0
func (c *DefaultCheckConfig) Copy() *DefaultCheckConfig
Copy returns a deep copy of this configuration.
func (*DefaultCheckConfig) Finalize ¶ added in v0.6.0
func (c *DefaultCheckConfig) Finalize()
Finalize ensures that the receiver contains no nil pointers.
func (*DefaultCheckConfig) GoString ¶ added in v0.6.0
func (c *DefaultCheckConfig) GoString() string
GoString defines the printable version of this struct.
func (*DefaultCheckConfig) Merge ¶ added in v0.6.0
func (c *DefaultCheckConfig) Merge(o *DefaultCheckConfig) *DefaultCheckConfig
Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence.
func (*DefaultCheckConfig) Validate ¶ added in v0.6.0
func (c *DefaultCheckConfig) 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 DriverConfig ¶
type DriverConfig struct { Terraform *TerraformConfig `mapstructure:"terraform"` // contains filtered or unexported fields }
DriverConfig is the configuration for the CTS 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 ModuleInputConfig ¶ added in v0.5.0
type ModuleInputConfig interface { MonitorConfig }
ModuleInputConfig configures a module_input on a task. The module input defines the Consul object(s) to monitor (e.g. services, kv). The object values as passed to the task module's input variable
type ModuleInputConfigs ¶ added in v0.5.0
type ModuleInputConfigs []ModuleInputConfig
ModuleInputConfigs is a collection of ModuleInputConfig
func DefaultModuleInputConfigs ¶ added in v0.5.0
func DefaultModuleInputConfigs() *ModuleInputConfigs
func (*ModuleInputConfigs) Copy ¶ added in v0.5.0
func (c *ModuleInputConfigs) Copy() *ModuleInputConfigs
Copy returns a deep copy of this configuration.
func (*ModuleInputConfigs) Finalize ¶ added in v0.5.0
func (c *ModuleInputConfigs) Finalize()
Finalize ensures the configuration has no nil pointers and sets default values.
func (*ModuleInputConfigs) GoString ¶ added in v0.5.0
func (c *ModuleInputConfigs) GoString() string
GoString defines the printable version of this struct.
func (*ModuleInputConfigs) Len ¶ added in v0.5.0
func (c *ModuleInputConfigs) Len() int
Len is a helper method to get the length of the underlying config list
func (*ModuleInputConfigs) Merge ¶ added in v0.5.0
func (c *ModuleInputConfigs) Merge(o *ModuleInputConfigs) *ModuleInputConfigs
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 (*ModuleInputConfigs) Validate ¶ added in v0.5.0
func (c *ModuleInputConfigs) Validate(services []string, condition ConditionConfig) error
Validate validates the values and nested values of the configuration struct. It validates a task's module inputs while taking into account the task's services and condition
type MonitorConfig ¶ added in v0.4.0
type MonitorConfig interface { Copy() MonitorConfig Merge(MonitorConfig) MonitorConfig Finalize() Validate() error GoString() string // VariableType returns type of variable that a module_input or a condition // block monitors. For example, `condition "services"` monitors the variable // type "services. // // Used to ensure requirement that configured monitored variable types are // unique for a given task. Must be unique across module_input, condition, // and services. VariableType() string }
MonitorConfig represents the base object for objects like monitor_input and condition, both of which "monitor" an object in order to perform some action
type NoConditionConfig ¶ added in v0.5.0
type NoConditionConfig struct {
NoConditionMonitorConfig `mapstructure:",squash" json:"no-condition"`
}
func (*NoConditionConfig) Copy ¶ added in v0.5.0
func (c *NoConditionConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*NoConditionConfig) Finalize ¶ added in v0.5.0
func (c *NoConditionConfig) Finalize()
Finalize ensures there no nil pointers.
func (*NoConditionConfig) GoString ¶ added in v0.5.0
func (c *NoConditionConfig) GoString() string
GoString defines the printable version of this struct.
func (*NoConditionConfig) Merge ¶ added in v0.5.0
func (c *NoConditionConfig) Merge(_ MonitorConfig) MonitorConfig
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 (*NoConditionConfig) Validate ¶ added in v0.5.0
func (c *NoConditionConfig) 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.
func (*NoConditionConfig) VariableType ¶ added in v0.5.0
func (c *NoConditionConfig) VariableType() string
type NoConditionMonitorConfig ¶ added in v0.7.0
type NoConditionMonitorConfig struct{}
NoConditionMonitorConfig is used to set a non-null value to a task's condition configuration block when it is unconfigured.
type ScheduleConditionConfig ¶ added in v0.4.0
type ScheduleConditionConfig struct {
ScheduleMonitorConfig `mapstructure:",squash" json:"schedule"`
}
ScheduleConditionConfig configures a condition configuration block of type 'schedule'. A schedule condition is triggered by a configured cron schedule
func (*ScheduleConditionConfig) Copy ¶ added in v0.4.0
func (c *ScheduleConditionConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*ScheduleConditionConfig) Finalize ¶ added in v0.4.0
func (c *ScheduleConditionConfig) Finalize()
Finalize ensures there no nil pointers.
func (*ScheduleConditionConfig) GoString ¶ added in v0.4.0
func (c *ScheduleConditionConfig) GoString() string
GoString defines the printable version of this struct.
func (*ScheduleConditionConfig) Merge ¶ added in v0.4.0
func (c *ScheduleConditionConfig) Merge(o MonitorConfig) MonitorConfig
Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence.
func (*ScheduleConditionConfig) Validate ¶ added in v0.4.0
func (c *ScheduleConditionConfig) 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.
func (*ScheduleConditionConfig) VariableType ¶ added in v0.5.0
func (c *ScheduleConditionConfig) VariableType() string
type ScheduleMonitorConfig ¶ added in v0.7.0
type ScheduleMonitorConfig struct {
Cron *string `mapstructure:"cron" json:"cron"`
}
ScheduleMonitorConfig exists purely to allow json / hcl conversions to work seamlessly by encoding and decoding under the "schedule" name. It should not be treated as a standalone module input.
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 CTS. 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 CTS ACL token, or // default to the `default` namespace. Namespace *string `mapstructure:"namespace"` // 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 CTS 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 ¶
func (c *ServiceConfig) Merge(o *ServiceConfig) *ServiceConfig
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 ¶
func (c *ServiceConfigs) Merge(o *ServiceConfigs) *ServiceConfigs
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 ServiceRegistrationConfig ¶ added in v0.6.0
type ServiceRegistrationConfig struct { Enabled *bool `mapstructure:"enabled"` ServiceName *string `mapstructure:"service_name"` Address *string `mapstructure:"address"` Namespace *string `mapstructure:"namespace"` DefaultCheck *DefaultCheckConfig `mapstructure:"default_check"` }
ServiceRegistrationConfig is a configuration that controls how CTS will register itself as a service with Consul.
func DefaultServiceRegistrationConfig ¶ added in v0.6.0
func DefaultServiceRegistrationConfig() *ServiceRegistrationConfig
DefaultServiceRegistrationConfig returns a ServiceRegistrationConfig with default values.
func (*ServiceRegistrationConfig) Copy ¶ added in v0.6.0
func (c *ServiceRegistrationConfig) Copy() *ServiceRegistrationConfig
Copy returns a deep copy of this configuration.
func (*ServiceRegistrationConfig) Finalize ¶ added in v0.6.0
func (c *ServiceRegistrationConfig) Finalize()
Finalize ensures that the receiver contains no nil pointers.
func (*ServiceRegistrationConfig) GoString ¶ added in v0.6.0
func (c *ServiceRegistrationConfig) GoString() string
GoString defines the printable version of this struct.
func (*ServiceRegistrationConfig) Merge ¶ added in v0.6.0
func (c *ServiceRegistrationConfig) Merge(o *ServiceRegistrationConfig) *ServiceRegistrationConfig
Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence.
func (*ServiceRegistrationConfig) Validate ¶ added in v0.6.0
func (c *ServiceRegistrationConfig) 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 ServicesConditionConfig ¶ added in v0.2.0
type ServicesConditionConfig struct { ServicesMonitorConfig `mapstructure:",squash" json:"services"` // UseAsModuleInput was previously named SourceIncludesVar - deprecated v0.5 UseAsModuleInput *bool `mapstructure:"use_as_module_input" json:"use_as_module_input"` DeprecatedSourceIncludesVar *bool `mapstructure:"source_includes_var" json:"source_includes_var"` }
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 task's services.
func (*ServicesConditionConfig) Copy ¶ added in v0.2.0
func (c *ServicesConditionConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*ServicesConditionConfig) Finalize ¶ added in v0.2.0
func (c *ServicesConditionConfig) Finalize()
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
func (c *ServicesConditionConfig) Merge(o MonitorConfig) MonitorConfig
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
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 ServicesModuleInputConfig ¶ added in v0.5.0
type ServicesModuleInputConfig struct {
ServicesMonitorConfig `mapstructure:",squash" json:"services"`
}
ServicesModuleInputConfig configures a module_input configuration block of type 'services'. Data about the services monitored will be used as input for the module variables.
func (*ServicesModuleInputConfig) Copy ¶ added in v0.5.0
func (c *ServicesModuleInputConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*ServicesModuleInputConfig) Finalize ¶ added in v0.5.0
func (c *ServicesModuleInputConfig) Finalize()
Finalize ensures there are no nil pointers.
func (*ServicesModuleInputConfig) GoString ¶ added in v0.5.0
func (c *ServicesModuleInputConfig) GoString() string
GoString defines the printable version of this struct.
func (*ServicesModuleInputConfig) Merge ¶ added in v0.5.0
func (c *ServicesModuleInputConfig) Merge(o MonitorConfig) MonitorConfig
Merge combines all values in this configuration `c` with the values in the other configuration `o`, 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 (*ServicesModuleInputConfig) Validate ¶ added in v0.5.0
func (c *ServicesModuleInputConfig) 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 ServicesMonitorConfig ¶ added in v0.4.0
type ServicesMonitorConfig struct { // Regexp configures the services to monitor by matching on the service name. // Either Regexp or Names must be configured, not both. When Regexp is unset, // it will retain a nil value even after Finalize(). Regexp *string `mapstructure:"regexp" json:"regexp"` // Names configures the services to monitor by listing the service name. // Either Regexp or Names must be configured, not both. Names []string `mapstructure:"names" json:"names"` // Datacenter is the datacenter the service is deployed in. Datacenter *string `mapstricture:"datacenter" json:"datacenter"` // Namespace is the namespace of the service (Consul Enterprise only). If // not provided, the namespace will be inferred from the CTS ACL token, or // default to the `default` namespace. Namespace *string `mapstructure:"namespace" json:"namespace"` // Filter is used to filter nodes based on a Consul compatible filter // expression. Filter *string `mapstructure:"filter" json:"filter"` // CTSUserDefinedMeta is metadata added to a service automated by CTS for // network infrastructure automation. CTSUserDefinedMeta map[string]string `mapstructure:"cts_user_defined_meta" json:"cts_user_defined_meta"` }
ServicesMonitorConfig configures a configuration block adhering to the monitor interface of type 'services'. A services monitor watches for changes that occur to services. ServicesMonitorConfig shares similar fields as the deprecated ServiceConfig
func (*ServicesMonitorConfig) Copy ¶ added in v0.4.0
func (c *ServicesMonitorConfig) Copy() MonitorConfig
Copy returns a deep copy of this configuration.
func (*ServicesMonitorConfig) Finalize ¶ added in v0.4.0
func (c *ServicesMonitorConfig) Finalize()
Finalize ensures there no nil pointers.
Exception: `Regexp` is never finalized and can potentially be nil.
- There is a need to distinguish betweeen nil regex (unconfigured regex) and empty string regex ("" regex pattern) at Validate().
- Setting `Regexp` as an empty string is not idempotent. There is a need to call Finalize() and Validate() multiple times.
func (*ServicesMonitorConfig) GoString ¶ added in v0.4.0
func (c *ServicesMonitorConfig) GoString() string
GoString defines the printable version of this struct.
func (*ServicesMonitorConfig) Merge ¶ added in v0.4.0
func (c *ServicesMonitorConfig) Merge(o MonitorConfig) MonitorConfig
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 (*ServicesMonitorConfig) Validate ¶ added in v0.4.0
func (c *ServicesMonitorConfig) 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().
func (*ServicesMonitorConfig) VariableType ¶ added in v0.5.0
func (c *ServicesMonitorConfig) VariableType() string
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 ¶
ConsulEnv returns an environment map of the TLS configuration for Consul
func (*TLSConfig) FinalizeConsul ¶ added in v0.4.2
func (c *TLSConfig) FinalizeConsul()
FinalizeConsul resolves the configuration with environment variables for Consul.
func (*TLSConfig) FinalizeVault ¶ added in v0.4.2
func (c *TLSConfig) FinalizeVault()
FinalizeVault resolves the configuration with environment variables for Vault.
type TaskConfig ¶
type TaskConfig struct { // Description is a human readable text to describe the task. Description *string `mapstructure:"description" json:"description"` // Name is the unique name of the task. Name *string `mapstructure:"name" json:"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" json:"providers"` // DeprecatedServices is the list of service IDs or logical service names the task // executes on. CTS 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. // - Deprecated in 0.5. Use names field of `condition "services"` and // `module_input "services"` instead DeprecatedServices []string `mapstructure:"services" json:"services"` // Module is the path to fetch the Terraform Module (local or remote). // Previously named Source - Deprecated in 0.5 Module *string `mapstructure:"module" json:"module"` DeprecatedSource *string `mapstructure:"source" json:"source"` // ModuleInputs defines the Consul objects (e.g. services, kv) whose values // are provided as the task module's input variables. // Previously named SourceInput - Deprecated in 0.5 ModuleInputs *ModuleInputConfigs `mapstructure:"module_input" json:"module_input"` DeprecatedSourceInputs *ModuleInputConfigs `mapstructure:"source_input" json:"source_input"` // 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. VarFiles are read into the Variables map in the same order they appear in the file. VarFiles []string `mapstructure:"variable_files" json:"variable_files"` // Variables are loaded in the same order as they appear in the map. // Duplicate variables are overwritten with the later value. // No validation is performed on the Variables, as this is not set by the configuration Variables map[string]string `mapstructure:"variables" json:"variables"` // Version is the module version for the task to use. The latest version // will be used as the default if omitted. Version *string `mapstructure:"version" json:"version"` // The Terraform client version to use for the task when configured with CTS // enterprise and the Terraform Cloud driver. This option is not supported // when using CTS OSS or the Terraform driver. // - Deprecated in 0.6. Use `terraform_cloud_workspace.terraform_version` instead DeprecatedTFVersion *string `mapstructure:"terraform_version" json:"terraform_version"` // The workspace configurations to use for the task when configured with CTS // enterprise and the Terraform Cloud driver. This option is not supported // when using CTS OSS or the Terraform driver. TFCWorkspace *TerraformCloudWorkspaceConfig `mapstructure:"terraform_cloud_workspace" json:"terraform_cloud_workspace"` // BufferPeriod configures per-task buffer timers. BufferPeriod *BufferPeriodConfig `mapstructure:"buffer_period" json:"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" json:"enabled"` // Condition optionally configures a single run condition under which the // task will start executing Condition ConditionConfig `mapstructure:"condition" json:"condition"` // The local working directory for CTS to manage Terraform configuration // files and artifacts that are generated for the task. The default option // will create a child directory with the task name in the global working // directory. WorkingDir *string `mapstructure:"working_dir" json:"working_dir"` }
TaskConfig is the configuration for a CTS 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() error
Finalize ensures there are 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) InheritParentConfig ¶ added in v0.7.0
func (c *TaskConfig) InheritParentConfig(parentWorkDir string, parentBufferPeriod BufferPeriodConfig) *TaskConfig
InheritParentConfig takes in parent configuration parameters and uses them to determine values when Task configuration is not set. It returns a copy of the configuration so the receiver is not mutated
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) SetVariables ¶ added in v0.7.0
func (c *TaskConfig) SetVariables() error
SetVariables sets the task variables map with values read from a configured variables file. Field values read in from the file will overwrite the same fields if they exist already within the config Variables. This function is called by Finalize and does not need to be called explicitly in most cases
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.
func (*TaskConfig) ValidateForDriver ¶ added in v0.7.0
func (c *TaskConfig) ValidateForDriver() error
ValidateForDriver validates all remaining values and required options that were not checked during the normal Validate() call. This method is recommended to run after:
- Finalize()
- Validate()
- InheritParentConfig()
It is intended to indicate whether a task is safe to be converted into a driver for execution.
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() error
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 TerraformCloudWorkspaceConfig ¶ added in v0.6.0
type TerraformCloudWorkspaceConfig struct { ExecutionMode *string `mapstructure:"execution_mode" json:"execution_mode"` AgentPoolID *string `mapstructure:"agent_pool_id" json:"agent_pool_id"` AgentPoolName *string `mapstructure:"agent_pool_name" json:"agent_pool_name"` TerraformVersion *string `mapstructure:"terraform_version" json:"terraform_version"` }
TerraformCloudWorkspaceConfig is an enterprise-only configuration that controls workspace attributes that are specific to a task.
func DefaultTerraformCloudWorkspaceConfig ¶ added in v0.6.0
func DefaultTerraformCloudWorkspaceConfig() *TerraformCloudWorkspaceConfig
func (*TerraformCloudWorkspaceConfig) Copy ¶ added in v0.6.0
func (c *TerraformCloudWorkspaceConfig) Copy() *TerraformCloudWorkspaceConfig
Copy returns a deep copy of this configuration.
func (*TerraformCloudWorkspaceConfig) Finalize ¶ added in v0.6.0
func (c *TerraformCloudWorkspaceConfig) Finalize()
Finalize ensures that the receiver contains no nil pointers.
func (*TerraformCloudWorkspaceConfig) GoString ¶ added in v0.6.0
func (c *TerraformCloudWorkspaceConfig) GoString() string
GoString defines the printable version of this struct.
func (*TerraformCloudWorkspaceConfig) IsEmpty ¶ added in v0.6.0
func (c *TerraformCloudWorkspaceConfig) IsEmpty() bool
func (*TerraformCloudWorkspaceConfig) Merge ¶ added in v0.6.0
func (c *TerraformCloudWorkspaceConfig) Merge(o *TerraformCloudWorkspaceConfig) *TerraformCloudWorkspaceConfig
Merge combines all values in this configuration with the values in the other configuration, with values in the other configuration taking precedence.
func (*TerraformCloudWorkspaceConfig) Validate ¶ added in v0.6.0
func (c *TerraformCloudWorkspaceConfig) Validate() error
Validate validates the 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"` 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 ¶
func (c *TerraformConfig) Merge(o *TerraformConfig) *TerraformConfig
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 ¶
func (c *TerraformProviderConfigs) Copy() *TerraformProviderConfigs
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 ¶
func (c *TerraformProviderConfigs) Merge(o *TerraformProviderConfigs) *TerraformProviderConfigs
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 ¶
func (c *TransportConfig) Merge(o *TransportConfig) *TransportConfig
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.
Source Files ¶
- auth.go
- buffer_period.go
- condition.go
- condition_catalog_services.go
- condition_consul_kv.go
- condition_no.go
- condition_schedule.go
- condition_services.go
- config.go
- consul.go
- convert.go
- decode.go
- default_check.go
- driver.go
- flags.go
- merge.go
- module_input.go
- module_input_consul_kv.go
- module_input_services.go
- monitor.go
- monitor_catalog_services.go
- monitor_consul_kv.go
- monitor_services.go
- provider.go
- service.go
- service_registration.go
- syslog.go
- task.go
- terraform.go
- terraform_cloud_workspace.go
- tls.go
- tls_cts.go
- transport.go
- vault.go