Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseMigrationFile ¶
func ParseMigrationFile(filename string, source []byte) (*tfmigrate.MigrationConfig, error)
ParseMigrationFile parses a given source of migration file and returns a *tfmigrate.MigrationConfig. 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 .json).
Types ¶
type ConfigurationFile ¶ added in v0.2.0
type ConfigurationFile struct { // Tfmigrate is a top-level block. // It must contain only one block, and multiple blocks are not allowed. Tfmigrate TfmigrateBlock `hcl:"tfmigrate,block"` }
ConfigurationFile represents a file for CLI settings in HCL.
type HistoryBlock ¶ added in v0.2.0
type HistoryBlock struct { // Storage is a block for migration history data store. Storage StorageBlock `hcl:"storage,block"` }
HistoryBlock represents a block for migration history management in HCL.
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 StorageBlock ¶ added in v0.2.0
type StorageBlock struct { // Type is a type for storage. // Valid values are as follows: // - mock // - local // - s3 Type string `hcl:"type,label"` // Remain is a body of storage block. // We first decode only a block header and then decode schema depending on // its type label. Remain hcl.Body `hcl:",remain"` }
StorageBlock represents a block for migration history data store in HCL.
type TfmigrateBlock ¶ added in v0.2.0
type TfmigrateBlock struct { // MigrationDir is a path to directory where migration files are stored. // Default to `.` (current directory). MigrationDir string `hcl:"migration_dir,optional"` // IsBackendTerraformCloud is a boolean indicating whether a backend is // stored remotely in Terraform Cloud. Defaults to false. IsBackendTerraformCloud bool `hcl:"is_backend_terraform_cloud,optional"` // History is a block for migration history management. History *HistoryBlock `hcl:"history,block"` }
TfmigrateBlock represents a block for CLI settings in HCL.
type TfmigrateConfig ¶ added in v0.2.0
type TfmigrateConfig struct { // MigrationDir is a path to directory where migration files are stored. // Default to `.` (current directory). MigrationDir string // IsBackendTerraformCloud is a boolean representing whether the remote // backend is TerraformCloud. Defaults to a value of false. IsBackendTerraformCloud bool // History is a config for migration history management. History *history.Config }
TfmigrateConfig is a config for top-level CLI settings. TfmigrateBlock is just used for parsing HCL and TfmigrateConfig is used for building application logic.
func LoadConfigurationFile ¶ added in v0.2.0
func LoadConfigurationFile(filename string) (*TfmigrateConfig, error)
LoadConfigurationFile is a helper function which reads and parses a given configuration file.
func NewDefaultConfig ¶ added in v0.2.0
func NewDefaultConfig() *TfmigrateConfig
NewDefaultConfig returns a new instance of TfmigrateConfig.
func ParseConfigurationFile ¶ added in v0.2.0
func ParseConfigurationFile(filename string, source []byte) (*TfmigrateConfig, error)
ParseConfigurationFile parses a given source of configuration file and returns a TfmigrateConfig. 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 .json).