hclcreate

package
v0.0.0-...-7e26ddd Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTerraformerResourceName

func ConvertTerraformerResourceName(name string) string

ConvertTerraformerResourceName takes an input resource name as output by the Terraformer package and outputs the resource in gold-standard Terraform name format.

Types

type Config

type Config struct {
	// MigrationHistoryStorage is a map containing information needed for specifying tfmigrate
	//// history storage appropriately.
	MigrationHistoryStorage MigrationHistory `required:"true"`

	// TerraformVersion is the version of Terraform used.
	TerraformVersion string `required:"true"`
}

Config is a struct comprising the configuration needed for hclCreate

type HCLCreate

type HCLCreate interface {
	// CreateMainTF outputs a bytes slice which defines a baseline main.tf file.
	CreateMainTF(providers map[string]string) ([]byte, error)

	// CreateImports creates either import blocks or tfmigrate configuration to import resources
	// into Terraform state.
	CreateImports(uniqueID string, workspaceToDirectory map[string]string) error

	// CreateTFMigrate coordinates CreateTFMigrateConfiguration and CreateTFMigrateMigration to create the needed
	// components for TFMigrate to operate successfully.
	CreateTFMigrate(uniqueID string, workspaceToDirectory map[string]string) error

	// CreateTFMigrateConfiguration saves HCL which defines TFMigrate configuration.
	CreateTFMigrateConfiguration(workspaceToDirectory map[string]string) error

	// CreateTFMigrateMigration saves HCL which defines a TFMigrate migration.
	CreateTFMigrateMigration(
		uniqueID string,
		resourceToImportDataPair ResourceToImportDataPair,
		newResourceToWorkspace NewResourceToWorkspace,
		workspaceToDirectory map[string]string,
	) error

	// ExtractResourceDefinitions outputs a bytes slice which defines needed Terraform resources extracted from
	// another configuration file.
	ExtractResourceDefinitions(noNewResources bool, workspaceToDirectory map[string]string) error

	// WriteImportBlocks writes import blocks to .tf files for configurations using Terraform version 1.5.0 or higher.
	WriteImportBlocks(uniqueID string, workspaceToDirectory map[string]string) error
}

HCLCreate is an interface that provides pre-built methods for generating and manipulating common HCL configuration.

func NewHCLCreate

func NewHCLCreate(config Config, provider terraformValueObjects.Provider) (HCLCreate, error)

NewHCLCreate creates and returns a struct which implements the HCLCreate interface.

type ImportDataPair

type ImportDataPair struct {
	TerraformConfigLocation string

	RemoteCloudReference string
}

ImportDataPair is a struct that holds the data needed to write an individual import block

type MigrationHistory

type MigrationHistory struct {
	// StorageType is the name of the storage resource used to store migration history files.
	StorageType string

	// Bucket is the name of the bucket-like storage location used to store migration history files.
	Bucket string

	// Region is the region of the bucket for storage used to store migration history files. Only needed
	// when storageType is 's3'
	Region string
}

MigrationHistory is a map containing information needed for specifying tfmigrate history storage appropriately.

func (*MigrationHistory) Decode

func (mhd *MigrationHistory) Decode(value string) error

Decode is a custom decoder of the MigrationHistoryDataMap for use with the envconfig library.

type NewResourceToWorkspace

type NewResourceToWorkspace map[string]string

NewResourceToWorkspace is a map of resource unique id to workspace name

type ResourceIdentifier

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

ResourceIdentifier is a struct comprised of the fields necessary to uniquely identify a terraformer-generated resource.

type ResourceToImportDataPair

type ResourceToImportDataPair map[string]ImportDataPair

ResourceToImportDataPair is a map of resource unique id to ImportDataPair

type WorkspaceToHCL

type WorkspaceToHCL map[string]*hclwrite.File

WorkspaceToHCL is a map between workspace names and the corresponding hclwrite File object.

Jump to

Keyboard shortcuts

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