config

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const EnvVarPrefix = "CQ_VAR_"

EnvVarPrefix is a prefix for environment variable names to be exported for HCL substitution.

View Source
const (
	SourceHCL = "hcl"
)

Variables

This section is empty.

Functions

func EnvToHCLContext added in v0.15.11

func EnvToHCLContext(evalContext *hcl.EvalContext, prefix string, vars []string)

func ReadModuleConfigProfiles added in v0.15.11

func ReadModuleConfigProfiles(module string, block hcl.Body) (map[string]hcl.Body, error)

ReadModuleConfigProfiles separates the module config from the modules block, where block identifier is the module name.

Types

type CloudQuery

type CloudQuery struct {
	PluginDirectory string            `hcl:"plugin_directory,optional"`
	PolicyDirectory string            `hcl:"policy_directory,optional"`
	Logger          *logging.Config   `hcl:"logging,block"`
	Providers       RequiredProviders `hcl:"provider,block"`
	Connection      *Connection       `hcl:"connection,block"`
	History         *history.Config   `hcl:"history,block"`
}

func (CloudQuery) GetRequiredProvider added in v0.14.5

func (c CloudQuery) GetRequiredProvider(name string) (*RequiredProvider, error)

type Config

type Config struct {
	CloudQuery CloudQuery       `hcl:"cloudquery,block"`
	Providers  Providers        `hcl:"provider,block"`
	Policies   []*policy.Policy `hcl:"policy,block"`
	Modules    hcl.Body         `hcl:"modules,block"`
}

func (Config) GetProvider

func (c Config) GetProvider(name string) (*Provider, error)

type Connection

type Connection struct {
	DSN string `hcl:"dsn,attr"`
}

type Option added in v0.15.5

type Option func(*Parser)

func WithEnvironmentVariables added in v0.15.5

func WithEnvironmentVariables(prefix string, vars []string) Option

WithEnvironmentVariables fills hcl.Context with values of environment variables given in vars. Only variables that start with given prefix are considered. Prefix is removed from the name and the name is lower cased then.

func WithFS added in v0.15.5

func WithFS(fs afero.Fs) Option

type Parser

type Parser struct {
	HCLContext hcl.EvalContext
	// contains filtered or unexported fields
}

Parser is the main interface to read configuration files and other related files from disk.

It retains a cache of all files that are loaded so that they can be used to create source code snippets in diagnostics, etc.

func NewParser

func NewParser(options ...Option) *Parser

NewParser creates and returns a new Parser.

func (*Parser) LoadConfigFile

func (p *Parser) LoadConfigFile(path string) (*Config, hcl.Diagnostics)

func (*Parser) LoadConfigFromSource

func (p *Parser) LoadConfigFromSource(name string, data []byte) (*Config, hcl.Diagnostics)

func (*Parser) LoadFromSource added in v0.16.0

func (p *Parser) LoadFromSource(name string, data []byte) (hcl.Body, hcl.Diagnostics)

func (*Parser) LoadHCLFile

func (p *Parser) LoadHCLFile(path string) (hcl.Body, hcl.Diagnostics)

LoadHCLFile is a low-level method that reads the file at the given path, parses it, and returns the hcl.Body representing its root. In many cases it is better to use one of the other Load*File methods on this type, which additionally decode the root body in some way and return a higher-level construct.

If the file cannot be read at all -- e.g. because it does not exist -- then this method will return a nil body and error diagnostics. In this case callers may wish to ignore the provided error diagnostics and produce a more context-sensitive error instead.

The file will be parsed using the HCL native syntax

type Provider

type Provider struct {
	Name                          string   `hcl:"name,label"`
	Alias                         string   `hcl:"alias,optional"`
	Resources                     []string `hcl:"resources,optional"`
	Env                           []string `hcl:"env,optional"`
	Configuration                 []byte
	MaxParallelResourceFetchLimit uint64 `hcl:"max_parallel_resource_fetch_limit"`
	MaxGoroutines                 uint64 `hcl:"max_goroutines"`
}

type Providers added in v0.16.0

type Providers []*Provider

func (Providers) Names added in v0.16.0

func (pp Providers) Names() []string

type RequiredProvider

type RequiredProvider struct {
	Name    string  `hcl:"name,label"`
	Source  *string `hcl:"source,optional"`
	Version string  `hcl:"version"`
}

func (RequiredProvider) String added in v0.13.7

func (r RequiredProvider) String() string

type RequiredProviders added in v0.21.0

type RequiredProviders []*RequiredProvider

func (RequiredProviders) Distinct added in v0.21.0

func (r RequiredProviders) Distinct() RequiredProviders

Distinct returns one name per provider

func (RequiredProviders) Names added in v0.21.0

func (r RequiredProviders) Names() []string

type SourceType

type SourceType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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