writer

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package writer defines an interface which has a series of specific implementations of writers for Terracognita that know how to transform the specific Terraform structures to HCL or TFState

Index

Constants

View Source
const (
	// ResourceCategoryKey is an internal key used to specify the category of
	// a resource when writing, it'll be used to select in which file
	// will be written
	ResourceCategoryKey = "tc_category"

	// ModuleCategoryKey is the category used to identify
	// the Module
	ModuleCategoryKey = "tc_module"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options added in v0.6.0

type Options struct {
	// Interpolate means the ability to interpolate
	// variables in HCL files or building dependencies
	// in a TFState
	Interpolate bool

	// Module tells the Writers (basically HCL) that will
	// need also to write a Module, and the value is the
	// name it has
	Module string

	// ModuleVariables will be all the keys that we want
	// to use as variables when writing. If empty
	// means use all attributes as variables
	ModuleVariables map[string]struct{}

	// HCLProviderBlock make the HCL generate or not the
	// 'provider "" {}' block
	HCLProviderBlock bool
}

Options given to the writers

func (Options) HasModule added in v0.6.1

func (o Options) HasModule() bool

HasModule will check if the Module is empty or not

type Writer

type Writer interface {
	// Write sets the value with the key to the internal structure,
	// the value will be casted to the correct type of each
	// implementation and an error can be returned normally for
	// repeated keys
	Write(key string, value interface{}) error

	// Has checks if the key it's already written
	// or not
	Has(key string) (bool, error)

	// Sync writes the content of the writer
	// to the internal system. Each Writter may have
	// a different implementation of it with different
	// output formats
	Sync() error

	// Interpolate replaces the hardcoded resources link
	// with TF interpolation
	Interpolate(map[string]string)
}

Writer it's an interface used to abstract the logic of writing results to a Key Value without having to deal with types or internal structures

Jump to

Keyboard shortcuts

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