parser

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 OptionWithDownloads

func OptionWithDownloads(allowed 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)
}

type Metrics

type Metrics struct {
	Timings struct {
		DiskIODuration time.Duration
		ParseDuration  time.Duration
	}
	Counts struct {
		Blocks          int
		Modules         int
		ModuleDownloads int
		Files           int
	}
}

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

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

func (*Parser) Metrics

func (p *Parser) Metrics() Metrics

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

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

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