parser

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountFiles

func CountFiles() int

func Functions

func Functions(baseDir string) map[string]function.Function

Functions returns the set of functions that should be used to when evaluating expressions in the receiving scope.

func LoadBlocksFromFile

func LoadBlocksFromFile(file File) (hcl.Blocks, []block.Ignore, error)

func LoadTFVars

func LoadTFVars(filenames []string) (map[string]cty.Value, error)

Types

type Evaluator

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

func NewEvaluator

func NewEvaluator(
	projectRootPath string,
	modulePath string,
	workingDir string,
	moduleName string,
	blocks block.Blocks,
	inputVars map[string]cty.Value,
	moduleMetadata *ModulesMetadata,
	visitedModules []*visitedModule,
	stopOnHCLError bool,
	workspace string,
	ignores []block.Ignore,
) *Evaluator

func (*Evaluator) EvaluateAll

func (e *Evaluator) EvaluateAll() (block.Modules, error)

func (*Evaluator) ExportOutputs

func (e *Evaluator) ExportOutputs() cty.Value

export module outputs to a parent

type File

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

func LoadDirectory

func LoadDirectory(fullPath string, stopOnHCLError bool) ([]File, error)

type ModuleDefinition

type ModuleDefinition struct {
	Name       string
	Path       string
	Definition *block.Block
	Modules    []*block.Module
}

type ModuleMetadata

type ModuleMetadata struct {
	Key     string `json:"Key"`
	Source  string `json:"Source"`
	Version string `json:"Version"`
	Dir     string `json:"Dir"`
}

type ModulesMetadata

type ModulesMetadata struct {
	Modules []ModuleMetadata `json:"Modules"`
}

func LoadModuleMetadata

func LoadModuleMetadata(fullPath string) (*ModulesMetadata, error)

type Option

type Option func(p *Parser)

func OptionDoNotSearchTfFiles

func OptionDoNotSearchTfFiles() Option

func OptionSkipDownloaded

func OptionSkipDownloaded() Option

func OptionStopOnHCLError

func OptionStopOnHCLError() Option

func OptionWithExcludePaths

func OptionWithExcludePaths(paths []string) Option

func OptionWithTFVarsPaths

func OptionWithTFVarsPaths(paths []string) Option

func OptionWithWorkspaceName

func OptionWithWorkspaceName(workspaceName string) Option

type Parser

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

Parser is a tool for parsing terraform templates at a given file system location

func New

func New(initialPath string, options ...Option) *Parser

New creates a new Parser

func (*Parser) ParseDirectory

func (parser *Parser) ParseDirectory() (block.Modules, error)

ParseDirectory parses all terraform files within a given directory

func (*Parser) RemoveExcluded

func (parser *Parser) RemoveExcluded(path string, entries []fs.FileInfo) (valid []fs.FileInfo)

Jump to

Keyboard shortcuts

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