tf

package
v0.9.3-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package tf provides parsing and abstractions specific to Terraform.

Index

Constants

View Source
const (
	// ErrUnsupportedModSrc indicates that a module source string is unsupported.
	ErrUnsupportedModSrc errors.Kind = "unsupported module source"

	// ErrInvalidModSrc indicates that a module source string is invalid.
	ErrInvalidModSrc errors.Kind = "invalid module source"
)
View Source
const ErrHCLSyntax errors.Kind = "HCL syntax error"

ErrHCLSyntax represents a HCL syntax error

Variables

This section is empty.

Functions

func IsStack added in v0.3.1

func IsStack(path string) (bool, error)

IsStack tells if the file defined by path is a potential stack. Eg.: has a backend block or a provider block.

Types

type Module

type Module struct {
	Source string // Source is the module source path (eg.: directory, git path, etc).
}

Module represents a terraform module. Note that only the fields relevant for terramate are declared here.

func ParseModules

func ParseModules(path string) ([]Module, error)

ParseModules parses blocks of type "module" containing a single label.

func (Module) IsLocal

func (m Module) IsLocal() bool

IsLocal tells if module source is a local directory.

type Source

type Source struct {
	// URL is the Git URL of the source.
	URL string

	// Path is the path of the source URL. It includes the domain of the URL on it.
	// Eg. github.com/terramate-io/example
	Path string

	// PathScheme is the scheme of the path part.
	PathScheme string

	// Subdir is the subdir component of the source path, if any, as defined
	// here: https://www.terraform.io/language/modules/sources#modules-in-package-sub-directories
	Subdir string

	// Ref is the specific reference of this source, if any.
	Ref string

	// Raw source
	Raw string
}

Source represents a module source

func ParseSource

func ParseSource(modsource string) (Source, error)

ParseSource parses the given modsource string. The modsource must be a valid Terraform Git/Github source reference as documented in:

- https://www.terraform.io/language/modules/sources

Source references that are not Git/Github are not supported.

Jump to

Keyboard shortcuts

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