terraformercli

package
v0.0.0-...-d123b64 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTerraformerExecutor

func NewTerraformerExecutor(ctx context.Context, hclCreate hclcreate.HCLCreate, config TerraformerExecutorConfig, cliConfig Config, provider terraformValueObjects.Provider) (interfaces.TerraformerExecutor, error)

NewTerraformerExecutor creates and returns a new instance of TerraformerExecutor.

Types

type AWSEnvironment

type AWSEnvironment struct {
	AWSAccessKeyID     string `json:"awsAccessKeyID"`
	AWSSecretKeyAccess string `json:"awsSecretAccessKey"`
}

AWSEnvironment is a struct defining the credential values needed for authenticating with an AWS account.

type AWSScanner

type AWSScanner struct {

	// CloudRegions represents the list of cloud regions that will be considered for inclusion in the import statement.
	CloudRegions []terraformValueObjects.CloudRegion `required:"true"`
	// contains filtered or unexported fields
}

AWSScanner implements the Scanner interface for use with AWS cloud environments.

func (*AWSScanner) Scan

Scan uses the TerraformerCLI interface to scan a given division's cloud environment

type AzureEnvironment

type AzureEnvironment struct {
	ClientID       string `json:"client_id"`
	ClientSecret   string `json:"client_secret"`
	TenantID       string `json:"tenant_id"`
	SubscriptionID string `json:"subscription_id"`
}

AzureEnvironment represents the configuration to run terraformer for Azure

type AzureScanner

type AzureScanner struct {

	// CloudRegions represents the list of cloud regions that will be considered for inclusion in the import statement.
	CloudRegions []terraformValueObjects.CloudRegion `required:"true"`
	// contains filtered or unexported fields
}

AzureScanner implements the Scanner interface for use with Azure cloud environments.

func (*AzureScanner) Scan

Scan uses the TerraformerCLI interface to scan a given division's cloud environment

type Config

type Config struct {
	// ResourcesWhiteList represents the list of resource names that will be exclusively considered for inclusion in the import statement.
	ResourcesWhiteList terraformValueObjects.ResourceNameList

	// ResourcesBlackList represents the list of resource names that will be excluded from consideration for inclusion in the import statement.
	ResourcesBlackList terraformValueObjects.ResourceNameList
}

Config is the struct that contains parameters considered to import the resources

type GoogleScanner

type GoogleScanner struct {

	// CloudRegions represents the list of cloud regions that will be considered for inclusion in the import statement.
	CloudRegions []terraformValueObjects.CloudRegion `required:"true"`
	// contains filtered or unexported fields
}

GoogleScanner implements the Scanner interface for use with GCP cloud environments.

func (*GoogleScanner) Scan

func (gcpScan *GoogleScanner) Scan(project terraformValueObjects.Division, credential terraformValueObjects.Credential, _ ...string) error

Scan uses the TerraformerCLI interface to scan a given division's cloud environment

type Scanner

type Scanner interface {
	// Scan uses the TerraformerCLI interface to scan a given division's cloud environment
	Scan(division terraformValueObjects.Division, credential terraformValueObjects.Credential, options ...string) error
}

Scanner interface allows scanning a single division within a cloud environment at a time.

func NewAWSScanner

func NewAWSScanner(credential terraformValueObjects.Credential, cliConfig Config, cloudRegions []terraformValueObjects.CloudRegion) (Scanner, error)

NewAWSScanner creates and returns a new instance of AWSScanner.

func NewAzureScanner

func NewAzureScanner(credential terraformValueObjects.Credential, cliConfig Config, cloudRegions []terraformValueObjects.CloudRegion) (Scanner, error)

NewAzureScanner creates and returns a new instance of AzureScanner.

func NewGoogleScanner

func NewGoogleScanner(credential terraformValueObjects.Credential, cliConfig Config, cloudRegions []terraformValueObjects.CloudRegion) (Scanner, error)

NewGoogleScanner creates and returns a new instance of GCPScanner.

type TerraformImportMigrationGeneratorParams

type TerraformImportMigrationGeneratorParams struct {
	Provider       string
	Resources      []string
	AdditionalArgs []string
	Regions        []string
	IsCompact      bool
}

TerraformImportMigrationGeneratorParams is the struct that wraps the params to run terraform import statement

type TerraformerCLI

type TerraformerCLI interface {
	// Import runs the `terraformer import` command to import all resources for the specified provider, division,
	// and specified credentials.
	Import(params TerraformImportMigrationGeneratorParams) error

	// UpdateState runs the `terraform state replace-provider` command to upgrade the state file generated
	// to version 4.
	UpdateState(provider string) error
}

TerraformerCLI interface is an abstraction on the methods needed within the terraformer package.

type TerraformerExecutor

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

TerraformerExecutor is a struct that implements interfaces.TerraformerExecutor

func (*TerraformerExecutor) Execute

func (e *TerraformerExecutor) Execute(_ context.Context) error

Execute runs the workflow needed to capture the current state of an external cloud environment via the terraformer package.

type TerraformerExecutorConfig

type TerraformerExecutorConfig struct {
	// CloudCredential is a cloud credential with read-only access to a cloud division and, if applicable, access to read Terraform state files.
	CloudCredential terraformValueObjects.Credential `required:"true"`

	// Division is the name of a cloud division. In AWS this is an account, in GCP this is a project name, and in Azure this is a subscription.
	Division terraformValueObjects.Division `required:"true"`

	// Provider is a map between a cloud provider and the version for that provider.
	Provider map[terraformValueObjects.Provider]string `required:"true"`

	// TerraformVersion is the version of Terraform used.
	TerraformVersion terraformValueObjects.Version `required:"true"`

	// CloudRegions represents the list of cloud regions that will be considered for inclusion in the import statement.
	CloudRegions terraformValueObjects.CloudRegionsDecoder `required:"true"`
}

TerraformerExecutorConfig is a struct containing the variables that determine the specific behavior of the TerraformerExecutor.

Jump to

Keyboard shortcuts

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