tfconf

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValueOf added in v0.8.1

func ValueOf(v interface{}) string

ValueOf returns JSON representation of the 'Default' value, which is an 'interface'.

Types

type Input

type Input struct {
	Name        string      `json:"name"`
	Type        String      `json:"type"`
	Description String      `json:"description"`
	Default     interface{} `json:"default"`
	Position    Position    `json:"-"`
}

Input represents a Terraform input.

func (*Input) HasDefault

func (i *Input) HasDefault() bool

HasDefault indicates if a Terraform variable has a default value set.

type Module

type Module struct {
	Header         string      `json:"header"`
	Inputs         []*Input    `json:"inputs"`
	Outputs        []*Output   `json:"outputs"`
	Providers      []*Provider `json:"providers"`
	RequiredInputs []*Input    `json:"-"`
	OptionalInputs []*Input    `json:"-"`
}

Module represents a Terraform mod. It consists of - Header ('header' json key): Module header found in shape of multi line comments at the beginning of 'main.tf' - Inputs ('inputs' json key): List of input 'variables' extracted from the Terraform module .tf files - Outputs ('outputs' json key): List of 'outputs' extracted from Terraform module .tf files - Providers ('providers' json key): List of 'providers' extracted from resources used in Terraform module

func CreateModule

func CreateModule(path string) (*Module, error)

CreateModule returns new instance of Module with all the inputs and outputs dircoverd from provided 'path' containing Terraform config

func (*Module) HasInputs

func (m *Module) HasInputs() bool

HasInputs indicates if the document has inputs.

func (*Module) HasOutputs

func (m *Module) HasOutputs() bool

HasOutputs indicates if the document has outputs.

func (*Module) Sort

func (m *Module) Sort(settings *print.Settings)

Sort sorts list of inputs and outputs based on provided flags (name, required, etc)

type Output

type Output struct {
	Name        string   `json:"name"`
	Description String   `json:"description"`
	Position    Position `json:"-"`
}

Output represents a Terraform output.

type Position

type Position struct {
	Filename string `json:"-"`
	Line     int    `json:"-"`
}

Position represents position of Terraform input or output in a file.

type Provider

type Provider struct {
	Name     string   `json:"name"`
	Alias    String   `json:"alias"`
	Version  String   `json:"version"`
	Position Position `json:"-"`
}

Provider represents a Terraform output.

func (*Provider) GetName

func (p *Provider) GetName() string

GetName returns full name of the provider, with alias if available

type String

type String string

String represents a 'string' value which JSON marshaled to `null` when empty

func (*String) MarshalJSON

func (s *String) MarshalJSON() ([]byte, error)

MarshalJSON custom marshal function which sets the value to literal `null` when empty

func (String) String added in v0.8.1

func (s String) String() string

String returns s as an actual string value

func (*String) UnmarshalJSON

func (s *String) UnmarshalJSON(in []byte) error

UnmarshalJSON custom unmarshal function which sets the value to `""` when the json property is `null`

Jump to

Keyboard shortcuts

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