terradep

package module
v0.0.0-...-22b8fc6 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package terradep allows to scan directories containing terraform deployments (main modules) with defined backend.

It detects resource terraform_remote_state in other deployments and builds dependency graph. This allows to visualize dependencies in your deployments and plan especially when you organize your code in Terraservices setup and you need orchestrating layer over Terraform.

terradep can represent your dependency graph in two formats:

  • Graphviz DOT - which can be piped to graph-easy to generate SVG, PNG or ASCII output
  • JSON Lines (mostly for debugging)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph struct {
	// Heads are Nodes which represent Terraform deployments without dependencies to other states
	Heads []*Node
}

Graph is acyclic directed graph showing dependencies between Terraform states

func (*Graph) String

func (g *Graph) String() string

String is insanely poor implementation of representing the Graph in JSON lines format. Assumes Node.String returns a JSON and concatenates them

type Node

type Node struct {
	Path     string
	State    State
	Parent   *Node
	Children []*Node
}

Node represents Terraform deployment

func (*Node) String

func (n *Node) String() string

type S3State

type S3State struct {
	// Bucket is name of S3 bucket
	Bucket string
	// Bucket key of the object in S3 bucket
	Key string
}

S3State represents Terraform state stored in S3 bucket

func (S3State) String

func (s S3State) String() string

String implements State

type Scanner

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

Scanner can scan the directories looking for a Terraform projects

func NewScanner

func NewScanner(globs map[string]struct{}) *Scanner

NewScanner returns initialized instance of Scanner

func (*Scanner) Scan

func (s *Scanner) Scan(root string) (*Graph, error)

Scan recursively scans the root directory and tries to find Terraform modules

type State

type State fmt.Stringer

State is used as unique identifier of Terraform state referenced by terraform_remote_state or in attribute backend in terraform block

Directories

Path Synopsis
cmd
cli
package main is entrypoint to terradep cli application
package main is entrypoint to terradep cli application
Package encoding provides functionality of visualizing objects of terradep
Package encoding provides functionality of visualizing objects of terradep
Package inspect contains code copied from terraform-config-inspect which is not exposed or must've been modified
Package inspect contains code copied from terraform-config-inspect which is not exposed or must've been modified

Jump to

Keyboard shortcuts

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