config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MigrationBlock

type MigrationBlock struct {
	// Type is a type for migration.
	// Valid values are `state` and `multi_state`.
	Type string `hcl:"type,label"`
	// Name is an arbitrary name for migration.
	Name string `hcl:"name,label"`
	// Remain is a body of migration block.
	// We first decode only a block header and then decode schema depending on
	// its type label.
	Remain hcl.Body `hcl:",remain"`
}

MigrationBlock represents a migration block in HCL.

type MigrationFile

type MigrationFile struct {
	// Migration is a migration block.
	// It must contain only one block, and multiple blocks are not allowed,
	// because it's hard to re-run the file if partially failed.
	Migration MigrationBlock `hcl:"migration,block"`
}

MigrationFile represents a config for migration written in HCL.

type MigratorConfig

type MigratorConfig interface {
	// NewMigrator returns a new instance of Migrator.
	NewMigrator(o *tfmigrate.MigratorOption) (tfmigrate.Migrator, error)
}

MigratorConfig is an interface of factory method for Migrator.

func ParseMigrationFile

func ParseMigrationFile(filename string, source []byte) (MigratorConfig, error)

ParseMigrationFile parses a given source of migration file and returns a MigratorConfig. Note that this method does not read a file and you should pass source of config in bytes. The filename is used for error message and selecting HCL syntax (.hcl and .hcl.json).

type MultiStateMigratorConfig

type MultiStateMigratorConfig struct {
	// FromDir is a working directory where states of resources move from.
	FromDir string `hcl:"from_dir"`
	// ToDir is a working directory where states of rsources move to.
	ToDir string `hcl:"to_dir"`
	// Actions is a list of multi state action.
	// action is a plain text for state operation.
	// Valid formats are the following.
	// "mv <source> <destination>"
	Actions []string `hcl:"actions"`
}

MultiStateMigratorConfig is a config for MultiStateMigrator.

func (*MultiStateMigratorConfig) NewMigrator

NewMigrator returns a new instance of MultiStateMigrator.

type StateMigratorConfig

type StateMigratorConfig struct {
	// Dir is a working directory for executing terraform command.
	// Default to `.` (current directory).
	Dir string `hcl:"dir,optional"`
	// Actions is a list of state action.
	// action is a plain text for state operation.
	// Valid formats are the following.
	// "mv <source> <destination>"
	// "rm <addresses>...
	// "import <address> <id>"
	// We could define strict block schema for action, but intentionally use a
	// schema-less string to allow us to easily copy terraform state command to
	// action.
	Actions []string `hcl:"actions"`
}

StateMigratorConfig is a config for StateMigrator.

func (*StateMigratorConfig) NewMigrator

NewMigrator returns a new instance of StateMigrator.

Jump to

Keyboard shortcuts

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