tf12parser

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 9 Imported by: 0

README

Portions of files in this directory are originally sourced from https://github.com/liamg/tfsec, copyright 2019 Liam Galvin.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

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

func NewAttribute

func NewAttribute(attr *hclsyntax.Attribute, ctx *hcl.EvalContext) *Attribute

func (*Attribute) IsLiteral

func (attr *Attribute) IsLiteral() bool

func (*Attribute) Name

func (attr *Attribute) Name() string

func (*Attribute) Range

func (attr *Attribute) Range() Range

func (*Attribute) Type

func (attr *Attribute) Type() cty.Type

func (*Attribute) Value

func (attr *Attribute) Value() cty.Value

type Block

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

func NewBlock

func NewBlock(hclBlock *hcl.Block, ctx *hcl.EvalContext) *Block

func (*Block) AllBlocks

func (block *Block) AllBlocks() []*Block

func (*Block) GetAttribute

func (block *Block) GetAttribute(name string) *Attribute

func (*Block) GetAttributes

func (block *Block) GetAttributes() []*Attribute

func (*Block) GetBlock

func (block *Block) GetBlock(name string) *Block

func (*Block) GetBlocks

func (block *Block) GetBlocks(name string) Blocks

func (*Block) Labels

func (block *Block) Labels() []string

func (*Block) Name

func (block *Block) Name() string

func (*Block) Range

func (block *Block) Range() Range

func (*Block) Type

func (block *Block) Type() string

type Blocks

type Blocks []*Block

func (Blocks) OfType

func (blocks Blocks) OfType(t string) Blocks

func (Blocks) RemoveDuplicates

func (blocks Blocks) RemoveDuplicates() Blocks

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() *Parser

New creates a new Parser

func (*Parser) ParseDirectory

func (parser *Parser) ParseDirectory(path string) (Blocks, error)

ParseDirectory recursively parses all terraform files within a given directory

func (*Parser) ParseFile

func (parser *Parser) ParseFile(path string) (Blocks, error)

func (*Parser) ParseMany

func (parser *Parser) ParseMany(paths []string) (Blocks, error)

type Range

type Range struct {
	Filename  string
	StartLine int
	EndLine   int
}

Range describes an area of code, including the filename it is present in and the lin numbers the code occupies

func (*Range) String

func (r *Range) String() string

String creates a human-readable summary of the range

Jump to

Keyboard shortcuts

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