preprocessor

package
v0.0.0-...-144d224 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Node_type_module             = "Module"
	Node_type_resource           = "Resource"
	Node_type_reference_resource = "ReferenceResource"
	Node_type_provider           = "Provider"
)
View Source
const (
	Resource_action_no_op   = "noop"
	Resource_action_created = "created"
)
View Source
const (
	State_current = "Current_State"
	State_planned = "Planned_State"
)
View Source
const (
	RootAddress = "_root"
)

Variables

This section is empty.

Functions

func EnrichStateFile

func EnrichStateFile(nodeTable map[string]Node, planFile []byte, tfConfigUrl string, tfConfigMainPath string) (map[string]Node, error)

EnrichStateFile takes an existing node table and enriches the nodes with the information that the provided json formatted plan file contains. It is assumed that the provided node Table only contains the planned values from a tfjson state file.

func ParsePlanFile

func ParsePlanFile(planFile []byte, tfConfigUrl string, tfConfigMainPath string) (map[string]Node, error)

ParsePlanFile takes a json formatted plan file and generates a node table from it.

func ParseStateFile

func ParseStateFile(stateFile []byte) (map[string]Node, error)

ParseStateFile takes a json formatted state file and generates a node table from it.

Types

type Module

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

Module represents a terraform module

func NewModule

func NewModule(
	address string,
	children []string,
) (*Module, error)

func (Module) AddAttribute

func (nodeData Module) AddAttribute(key string, attribute interface{})

func (Module) AddChild

func (nodeData Module) AddChild(address string)

func (Module) GetAddress

func (nodeData Module) GetAddress() string

func (Module) GetNodeType

func (nodeData Module) GetNodeType() string

func (*Module) MarshalBinary

func (module *Module) MarshalBinary() ([]byte, error)

func (Module) SetLocation

func (nodeData Module) SetLocation(location string)

type Node

type Node interface {
	GetNodeType() string
	GetAddress() string
	SetLocation(location string)
	AddChild(address string)
	AddAttribute(key string, attribute interface{})
}

type Provider

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

Provider represents a terraform provider

func NewProvider

func NewProvider(
	address string,
	children []string,
) (*Provider, error)

func (Provider) AddAttribute

func (nodeData Provider) AddAttribute(key string, attribute interface{})

func (Provider) AddChild

func (nodeData Provider) AddChild(address string)

func (Provider) GetAddress

func (nodeData Provider) GetAddress() string

func (Provider) GetNodeType

func (nodeData Provider) GetNodeType() string

func (*Provider) MarshalBinary

func (provider *Provider) MarshalBinary() ([]byte, error)

func (Provider) SetLocation

func (nodeData Provider) SetLocation(location string)

type ReferenceResource

type ReferenceResource struct {
	Dependencies []string `json:"dependencies,omitempty"`
	// contains filtered or unexported fields
}

func NewReferenceResource

func NewReferenceResource(
	address string,
	children []string,
	dependencies []string,
) (*ReferenceResource, error)

func (ReferenceResource) AddAttribute

func (nodeData ReferenceResource) AddAttribute(key string, attribute interface{})

func (ReferenceResource) AddChild

func (nodeData ReferenceResource) AddChild(address string)

func (ReferenceResource) GetAddress

func (nodeData ReferenceResource) GetAddress() string

func (ReferenceResource) GetNodeType

func (nodeData ReferenceResource) GetNodeType() string

func (ReferenceResource) MarshalBinary

func (nodeData ReferenceResource) MarshalBinary() ([]byte, error)

func (ReferenceResource) SetLocation

func (nodeData ReferenceResource) SetLocation(location string)

type Resource

type Resource struct {

	// Dependencies contain the addresses of the ressources on which this ressource depends
	Dependencies []string `json:"dependencies,omitempty"`
	// The  actions which are performed on the ressource when the plan file is executed.
	Actions []string `json:"actions,omitempty"`
	// States contain the attributes of a resource that are associated with a specific state
	States map[string]map[string]interface{} `json:"states,omitempty"`
	// contains filtered or unexported fields
}

Resource represents a terraform resource.

func NewResource

func NewResource(
	address string,
	dependencies []string,
) (*Resource, error)

func (Resource) AddAttribute

func (nodeData Resource) AddAttribute(key string, attribute interface{})

func (Resource) AddChild

func (nodeData Resource) AddChild(address string)

func (Resource) GetAddress

func (nodeData Resource) GetAddress() string

func (Resource) GetNodeType

func (nodeData Resource) GetNodeType() string

func (*Resource) MarshalBinary

func (resource *Resource) MarshalBinary() ([]byte, error)

func (Resource) SetLocation

func (nodeData Resource) SetLocation(location string)

Jump to

Keyboard shortcuts

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