parser

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 33 Imported by: 2

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.

func OptionStopOnHCLError

func OptionStopOnHCLError(stop bool) options.ParserOption

func OptionWithConfigsFS

func OptionWithConfigsFS(fsys fs.FS) options.ParserOption

func OptionWithDownloads

func OptionWithDownloads(allowed bool) options.ParserOption

func OptionWithSkipCachedModules

func OptionWithSkipCachedModules(b bool) options.ParserOption

func OptionWithTFVarsPaths

func OptionWithTFVarsPaths(paths ...string) options.ParserOption

func OptionWithWorkspaceName

func OptionWithWorkspaceName(workspaceName string) options.ParserOption

Types

type ConfigurableTerraformParser

type ConfigurableTerraformParser interface {
	options.ConfigurableParser
	SetTFVarsPaths(...string)
	SetStopOnHCLError(bool)
	SetWorkspaceName(string)
	SetAllowDownloads(bool)
	SetSkipCachedModules(bool)
	SetConfigsFS(fsys fs.FS)
}

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 ConfigurableTerraformParser)

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 ...options.ParserOption) *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 added in v0.51.0

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

func (*Parser) SetAllowDownloads

func (p *Parser) SetAllowDownloads(b bool)

func (*Parser) SetConfigsFS

func (p *Parser) SetConfigsFS(fsys fs.FS)

func (*Parser) SetDebugWriter

func (p *Parser) SetDebugWriter(writer io.Writer)

func (*Parser) SetSkipCachedModules

func (p *Parser) SetSkipCachedModules(b bool)

func (*Parser) SetSkipRequiredCheck

func (p *Parser) SetSkipRequiredCheck(b bool)

func (*Parser) SetStopOnHCLError

func (p *Parser) SetStopOnHCLError(b bool)

func (*Parser) SetTFVarsPaths

func (p *Parser) SetTFVarsPaths(s ...string)

func (*Parser) SetWorkspaceName

func (p *Parser) SetWorkspaceName(s string)

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