hcl

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package hcl provides some helper functions for various github.com/hashicorp/hcl/v2 packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lockfile

type Lockfile struct {
	Path      string
	Providers []*LockfileProvider `hcl:"provider,block"`
}

Lockfile represents a Terraform lockfile

func ParseLockfile

func ParseLockfile(filename string) (*Lockfile, error)

ParseLockfile parses a given file as a Terraform lockfile, and returns a Lockfile object representing the configuration. Will return an error if: the HCL parser fails to parse the file, or fails to read the file into the lockfile schema, or the file contains hcl blocks other than providers.

func (*Lockfile) CompactProviders

func (lf *Lockfile) CompactProviders() []string

CompactProviders returns a list of the receiver's providers, formatted in short (compact) strings, e.g. "name@version".

type LockfileProvider

type LockfileProvider struct {
	ID          string   `hcl:"id,label"`
	Version     string   `hcl:"version"`
	Constraints string   `hcl:"constraints,optional"`
	Hashes      []string `hcl:"hashes,optional"`
}

LockfileProvider represents a single `provider` block of a Lockfile

func (*LockfileProvider) String

func (lp *LockfileProvider) String() string

type Module

type Module interface {
	Configuration() *configuration
	Module() *tfconfig.Module
	ParseModuleDirectory(string) error
	Parser() *hclparse.Parser
	ParseTerraformFile(string) error
	DependencyGraph() (string, error)
}

Module is something that can parse a terraform module (configuration directory)

func NewModule

func NewModule(logger *logrus.Logger) Module

NewModule builds an object that conforms to the ModuleParser interface

Jump to

Keyboard shortcuts

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