parser

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoFiles = errors.New("no files found")

Functions

func Functions

func Functions(target fs.FS, baseDir string) map[string]function.Function

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

Types

type ModuleDefinition

type ModuleDefinition struct {
	Name       string
	Path       string
	FileSystem fs.FS
	Definition *terraform.Block
	Parser     *Parser
	External   bool
}

type ModuleResolver

type ModuleResolver interface {
	Resolve(context.Context, fs.FS, resolvers.Options) (filesystem fs.FS, prefix string, downloadPath string, applies bool, err error)
}

type Option

type Option func(p *Parser)

func OptionStopOnHCLError

func OptionStopOnHCLError(stop bool) Option

func OptionWithConfigsFS

func OptionWithConfigsFS(fsys fs.FS) Option

func OptionWithDownloads

func OptionWithDownloads(allowed bool) Option

func OptionWithSkipCachedModules

func OptionWithSkipCachedModules(b bool) Option

func OptionWithSkipDirs

func OptionWithSkipDirs(dirs []string) Option

func OptionWithSkipFiles

func OptionWithSkipFiles(files []string) Option

func OptionWithTFVarsPaths

func OptionWithTFVarsPaths(paths ...string) Option

func OptionWithWorkspaceName

func OptionWithWorkspaceName(workspaceName string) Option

func OptionsWithTfVars

func OptionsWithTfVars(vars map[string]cty.Value) 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(moduleFS fs.FS, moduleSource string, opts ...Option) *Parser

New creates a new Parser

func (*Parser) EvaluateAll

func (p *Parser) EvaluateAll(ctx context.Context) (terraform.Modules, cty.Value, error)

func (*Parser) FindRootModules

func (p *Parser) FindRootModules(ctx context.Context, dirs []string) ([]string, error)

FindRootModules takes a list of module paths and identifies the root local modules. It builds a graph based on the module dependencies and determines the modules that have no incoming dependencies, considering them as root modules.

func (*Parser) GetFilesystemMap

func (p *Parser) GetFilesystemMap() map[string]fs.FS

func (*Parser) Load

func (p *Parser) Load(ctx context.Context) (*evaluator, error)

func (*Parser) ParseFS

func (p *Parser) ParseFS(ctx context.Context, dir string) error

ParseFS parses a root module, where it exists at the root of the provided filesystem

func (*Parser) ParseFile

func (p *Parser) ParseFile(_ context.Context, fullPath string) error

Directories

Path Synopsis
Copied from github.com/hashicorp/terraform/internal/lang/funcs
Copied from github.com/hashicorp/terraform/internal/lang/funcs

Jump to

Keyboard shortcuts

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