module

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTerraformVersion

func GetTerraformVersion(ctx context.Context, mod Module)

func IsIgnoredFile

func IsIgnoredFile(name string) bool

IsIgnoredFile returns true if the given filename (which must not have a directory path ahead of it) should be ignored as e.g. an editor swap file.

func IsModuleNotFound

func IsModuleNotFound(err error) bool

func IsTerraformNotFound added in v0.14.0

func IsTerraformNotFound(err error) bool

func ObtainSchema

func ObtainSchema(ctx context.Context, mod Module)

func ParseConfiguration

func ParseConfiguration(mod Module)

func ParseModuleManifest

func ParseModuleManifest(mod Module)

func TerraformExecPath added in v0.14.0

func TerraformExecPath(ctx context.Context, mod Module) (string, error)

func TerraformExecutorForModule

func TerraformExecutorForModule(ctx context.Context, mod Module) (exec.TerraformExecutor, error)

Types

type File

type File interface {
	Path() string
}

type Module

type Module interface {
	Path() string
	HumanReadablePath(string) string
	MatchesPath(path string) bool
	HasOpenFiles() bool

	TerraformExecPath() string
	TerraformVersion() (*version.Version, error)
	ProviderVersions() map[string]*version.Version
	ProviderSchema() (*tfjson.ProviderSchemas, error)
	ModuleManifest() (*datadir.ModuleManifest, error)

	TerraformVersionState() OpState
	ProviderSchemaState() OpState

	ParsedFiles() (map[string]*hcl.File, error)
	Diagnostics() map[string]hcl.Diagnostics
	ModuleCalls() []datadir.ModuleRecord
}

func NewModule

func NewModule(fs filesystem.Filesystem, dir string) Module

type ModuleFactory

type ModuleFactory func(string) (*module, error)

type ModuleFinder

type ModuleFinder interface {
	ModuleByPath(path string) (Module, error)
	SchemaForModule(path string) (*schema.BodySchema, error)
	SchemaSourcesForModule(path string) ([]SchemaSource, error)
}

type ModuleLoader

type ModuleLoader func(dir string) (Module, error)

type ModuleManager

type ModuleManager interface {
	ModuleFinder

	SetLogger(logger *log.Logger)
	AddModule(modPath string) (Module, error)
	EnqueueModuleOp(modPath string, opType OpType) error
	EnqueueModuleOpWait(modPath string, opType OpType) error
	ListModules() []Module
	CancelLoading()
}

func NewModuleManager

func NewModuleManager(ctx context.Context, fs filesystem.Filesystem) ModuleManager

func NewSyncModuleManager

func NewSyncModuleManager(ctx context.Context, fs filesystem.Filesystem) ModuleManager

type ModuleManagerFactory

type ModuleManagerFactory func(context.Context, filesystem.Filesystem) ModuleManager

func NewModuleManagerMock

func NewModuleManagerMock(input *ModuleManagerMockInput) ModuleManagerFactory

type ModuleManagerMockInput

type ModuleManagerMockInput struct {
	Logger         *log.Logger
	TerraformCalls *exec.TerraformMockCalls
}

type ModuleNotFoundErr

type ModuleNotFoundErr struct {
	Dir string
}

func (*ModuleNotFoundErr) Error

func (e *ModuleNotFoundErr) Error() string

type ModuleOperation

type ModuleOperation struct {
	Module Module
	Type   OpType
	// contains filtered or unexported fields
}

func NewModuleOperation

func NewModuleOperation(mod Module, typ OpType) ModuleOperation

func (ModuleOperation) Done

func (mo ModuleOperation) Done() <-chan struct{}

type NoTerraformExecPathErr added in v0.14.0

type NoTerraformExecPathErr struct{}

func (NoTerraformExecPathErr) Error added in v0.14.0

type OpState

type OpState uint
const (
	OpStateUnknown OpState = iota
	OpStateQueued
	OpStateLoading
	OpStateLoaded
)

type OpType

type OpType uint
const (
	OpTypeUnknown OpType = iota
	OpTypeGetTerraformVersion
	OpTypeObtainSchema
	OpTypeParseConfiguration
	OpTypeParseModuleManifest
)

func (OpType) String

func (t OpType) String() string

type SchemaSource

type SchemaSource interface {
	// module specific methods
	Path() string
	HumanReadablePath(string) string

	ProviderSchema() (*tfjson.ProviderSchemas, error)
	TerraformVersion() (*version.Version, error)
	ProviderVersions() map[string]*version.Version
}

type Walker

type Walker struct {
	// contains filtered or unexported fields
}

func NewWalker

func NewWalker(fs filesystem.Filesystem, modMgr ModuleManager) *Walker

func SyncWalker

func SyncWalker(fs filesystem.Filesystem, modMgr ModuleManager) *Walker

func (*Walker) IsWalking

func (w *Walker) IsWalking() bool

func (*Walker) SetExcludeModulePaths

func (w *Walker) SetExcludeModulePaths(excludeModulePaths []string)

func (*Walker) SetLogger

func (w *Walker) SetLogger(logger *log.Logger)

func (*Walker) SetWatcher

func (w *Walker) SetWatcher(watcher Watcher)

func (*Walker) StartWalking

func (w *Walker) StartWalking(ctx context.Context, path string) error

func (*Walker) Stop

func (w *Walker) Stop()

type WalkerFactory

type WalkerFactory func(filesystem.Filesystem, ModuleManager) *Walker

type Watcher

type Watcher interface {
	Start() error
	Stop() error
	SetLogger(*log.Logger)
	AddModule(string) error
	IsModuleWatched(string) bool
}

func NewWatcher

func NewWatcher(fs filesystem.Filesystem, modMgr ModuleManager) (Watcher, error)

type WatcherFactory

type WatcherFactory func(filesystem.Filesystem, ModuleManager) (Watcher, error)

func MockWatcher

func MockWatcher() WatcherFactory

Jump to

Keyboard shortcuts

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