terraformcore

package
v1.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyArgs added in v1.2.1

type ApplyArgs interface {
	GetArgRefreshOnly() []string
	GetArgTerraformVarFiles() []string
	GetArgVars() []string
	GetArgAutoApprove() []string
}

type ApplyArgsOptions added in v1.2.1

type ApplyArgsOptions struct {
	// RefreshOnly is a flag to only refresh the state. Equivalent to
	// terraform plan -refresh-only
	RefreshOnly bool
	// TerraformVarFiles is a list of terraform var files to use
	TerraformVarFiles []string
	// Vars is a list of terraform vars to use
	Vars []TFInputVariable
	// AutoApprove is a flag to auto approve the plan
	AutoApprove bool
}

func (*ApplyArgsOptions) GetArgAutoApprove added in v1.2.1

func (po *ApplyArgsOptions) GetArgAutoApprove() []string

func (*ApplyArgsOptions) GetArgRefreshOnly added in v1.2.1

func (po *ApplyArgsOptions) GetArgRefreshOnly() []string

func (*ApplyArgsOptions) GetArgTerraformVarFiles added in v1.2.1

func (po *ApplyArgsOptions) GetArgTerraformVarFiles() []string

func (*ApplyArgsOptions) GetArgVars added in v1.2.1

func (po *ApplyArgsOptions) GetArgVars() []string

type DestroyArgs added in v1.2.1

type DestroyArgs interface {
	GetArgRefreshOnly() []string
	GetArgTerraformVarFiles() []string
	GetArgVars() []string
	GetArgAutoApprove() []string
}

type DestroyArgsOptions added in v1.2.1

type DestroyArgsOptions struct {
	// RefreshOnly is a flag to only refresh the state. Equivalent to
	// terraform plan -refresh-only
	RefreshOnly bool
	// TerraformVarFiles is a list of terraform var files to use
	TerraformVarFiles []string
	// Vars is a list of terraform vars to use
	Vars []TFInputVariable
	// AutoApprove is a flag to auto approve the plan
	AutoApprove bool
}

func (*DestroyArgsOptions) GetArgAutoApprove added in v1.2.1

func (po *DestroyArgsOptions) GetArgAutoApprove() []string

func (*DestroyArgsOptions) GetArgRefreshOnly added in v1.2.1

func (po *DestroyArgsOptions) GetArgRefreshOnly() []string

func (*DestroyArgsOptions) GetArgTerraformVarFiles added in v1.2.1

func (po *DestroyArgsOptions) GetArgTerraformVarFiles() []string

func (*DestroyArgsOptions) GetArgVars added in v1.2.1

func (po *DestroyArgsOptions) GetArgVars() []string

type GenerateTFInitCMDStrOptions added in v1.2.1

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

type GetTerraformLifecycleCMDStringOptions added in v1.2.1

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

type IacConfig

type IacConfig interface {
	GetBinary() string
	GetContainerImage() string
	GetVersion() string
}

type IacConfigOptions

type IacConfigOptions struct {
	Binary         string // Either terragrunt, or terraform.
	ContainerImage string
	Version        string
}

func (*IacConfigOptions) GetBinary

func (i *IacConfigOptions) GetBinary() string

func (*IacConfigOptions) GetContainerImage

func (i *IacConfigOptions) GetContainerImage() string

func (*IacConfigOptions) GetVersion

func (i *IacConfigOptions) GetVersion() string

type IacLifeCycleCommand added in v1.2.1

type IacLifeCycleCommand interface {
	Init(td *terradagger.TD, tfOpts TfGlobalOptions, options InitArgs, extraArgs []string) (*dagger.Container, container.Runtime, error)
	InitE(td *terradagger.TD, tfOpts TfGlobalOptions, options InitArgs, extraArgs []string) (string, error)
	Plan(td *terradagger.TD, tfOpts TfGlobalOptions, options PlanArgs, extraArgs []string) (*dagger.Container, container.Runtime, error)
	PlanE(td *terradagger.TD, tfOpts TfGlobalOptions, options PlanArgs, extraArgs []string) (string, error)
	Apply(td *terradagger.TD, tfOpts TfGlobalOptions, options ApplyArgs, extraArgs []string) (*dagger.Container, container.Runtime, error)
	ApplyE(td *terradagger.TD, tfOpts TfGlobalOptions, options ApplyArgs, extraArgs []string) (string, error)
	Destroy(td *terradagger.TD, tfOpts TfGlobalOptions, options DestroyArgs, extraArgs []string) (*dagger.Container, container.Runtime, error)
	DestroyE(td *terradagger.TD, tfOpts TfGlobalOptions, options DestroyArgs, extraArgs []string) (string, error)
}

type IasC

type IasC struct {
	Config IacConfig
}

func (*IasC) Apply added in v1.2.1

func (i *IasC) Apply(td *terradagger.TD, tfOpts TfGlobalOptions, options ApplyArgs, _ []string) (*dagger.Container, container.Runtime, error)

func (*IasC) ApplyE added in v1.2.1

func (i *IasC) ApplyE(td *terradagger.TD, tfOpts TfGlobalOptions, options ApplyArgs, extraArgs []string) (string, error)

func (*IasC) Destroy added in v1.2.1

func (i *IasC) Destroy(td *terradagger.TD, tfOpts TfGlobalOptions, options DestroyArgs, _ []string) (*dagger.Container, container.Runtime, error)

func (*IasC) DestroyE added in v1.2.1

func (i *IasC) DestroyE(td *terradagger.TD, tfOpts TfGlobalOptions, options DestroyArgs, extraArgs []string) (string, error)

func (*IasC) Init

func (i *IasC) Init(td *terradagger.TD, tfOpts TfGlobalOptions, options InitArgs, _ []string) (*dagger.Container, container.Runtime, error)

func (*IasC) InitE

func (i *IasC) InitE(td *terradagger.TD, tfOpts TfGlobalOptions, options InitArgs, extraArgs []string) (string, error)

func (*IasC) Plan

func (i *IasC) Plan(td *terradagger.TD, tfOpts TfGlobalOptions, options PlanArgs, _ []string) (*dagger.Container, container.Runtime, error)

func (*IasC) PlanE

func (i *IasC) PlanE(td *terradagger.TD, tfOpts TfGlobalOptions, options PlanArgs, extraArgs []string) (string, error)

type InitArgs

type InitArgs interface {
	GetArgNoColor() []string
	GetArgBackendConfigFile() []string
	GetArgUpgrade() []string
}

type InitArgsOptions added in v1.2.1

type InitArgsOptions struct {
	// NoColor is a flag to disable colors in terraform output
	NoColor bool
	// BackendConfigFile is the path to the backend config file
	BackendConfigFile string
	// Upgrade is a flag to upgrade the modules and plugins
	Upgrade bool
}

func (*InitArgsOptions) GetArgBackendConfigFile added in v1.2.1

func (ti *InitArgsOptions) GetArgBackendConfigFile() []string

func (*InitArgsOptions) GetArgNoColor added in v1.2.1

func (ti *InitArgsOptions) GetArgNoColor() []string

func (*InitArgsOptions) GetArgUpgrade added in v1.2.1

func (ti *InitArgsOptions) GetArgUpgrade() []string

type LifecycleCommandConfig added in v1.2.1

type LifecycleCommandConfig interface {
	GetEntryPoint(iaacTool string) string
	GetInitCommand() string
	GetPlanCommand() string
	GetApplyCommand() string
	GetDestroyCommand() string
	GetValidateCommand() string
}

type PlanArgs

type PlanArgs interface {
	GetArgRefreshOnly() []string
	GetArgTerraformVarFiles() []string
	GetArgVars() []string
}

type PlanArgsOptions added in v1.2.1

type PlanArgsOptions struct {
	// RefreshOnly is a flag to only refresh the state. Equivalent to
	// terraform plan -refresh-only
	RefreshOnly bool
	// TerraformVarFiles is a list of terraform var files to use
	TerraformVarFiles []string
	// Vars is a list of terraform vars to use
	Vars []TFInputVariable
}

func (*PlanArgsOptions) GetArgRefreshOnly added in v1.2.1

func (po *PlanArgsOptions) GetArgRefreshOnly() []string

func (*PlanArgsOptions) GetArgTerraformVarFiles added in v1.2.1

func (po *PlanArgsOptions) GetArgTerraformVarFiles() []string

func (*PlanArgsOptions) GetArgVars added in v1.2.1

func (po *PlanArgsOptions) GetArgVars() []string

type TFInputVariable

type TFInputVariable struct {
	Name  string
	Value string
}

type TerraformContainerConfig added in v1.2.1

type TerraformContainerConfig interface {
	GetTfOptions() TfGlobalOptions
	GetIacConfig() IacConfig
}

type TerraformContainerConfigOptions added in v1.2.1

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

func (*TerraformContainerConfigOptions) AddEnvVarsToTerraformContainer added in v1.2.1

func (t *TerraformContainerConfigOptions) AddEnvVarsToTerraformContainer(td *terradagger.TD, runtime container.Runtime, tfContainer *dagger.Container) *dagger.Container

AddEnvVarsToTerraformContainer configures the container with the appropriate environment variables.

func (*TerraformContainerConfigOptions) GetIacConfig added in v1.2.1

func (t *TerraformContainerConfigOptions) GetIacConfig() IacConfig

func (*TerraformContainerConfigOptions) GetTfOptions added in v1.2.1

type TerraformContainerSetup added in v1.2.1

type TerraformContainerSetup interface {
	AddEnvVarsToTerraformContainer(td *terradagger.TD, runtime container.Runtime, tfContainer *dagger.Container) *dagger.Container
	// contains filtered or unexported methods
}

type TerraformRunner added in v1.2.1

type TerraformRunner interface {
	RunInit(binary string, options *InitArgsOptions) (*dagger.Container, container.Runtime, error)
	RunInitE(binary string, options *InitArgsOptions) (string, error)
	RunPlan(binary string, options *PlanArgsOptions) (*dagger.Container, container.Runtime, error)
	RunPlanE(binary string, options *PlanArgsOptions) (string, error)
	RunApply(binary string, options *ApplyArgsOptions) (*dagger.Container, container.Runtime, error)
	RunApplyE(binary string, options *ApplyArgsOptions) (string, error)
	RunDestroy(binary string, options *DestroyArgsOptions) (*dagger.Container, container.Runtime, error)
	RunDestroyE(binary string, options *DestroyArgsOptions) (string, error)
}

func NewTerraformRunner added in v1.2.1

func NewTerraformRunner(td *terradagger.TD, tfGLobalOptions TfGlobalOptions) TerraformRunner

func NewTerragruntRunner added in v1.2.1

func NewTerragruntRunner(td *terradagger.TD, tfGLobalOptions TfGlobalOptions, tgConfig TerragruntConfig) TerraformRunner

type TerraformRunnerOptions added in v1.2.1

type TerraformRunnerOptions struct {
	TfGlobalOptions TfGlobalOptions
	// contains filtered or unexported fields
}

func (*TerraformRunnerOptions) RunApply added in v1.2.1

func (*TerraformRunnerOptions) RunApplyE added in v1.2.1

func (t *TerraformRunnerOptions) RunApplyE(binary string, args *ApplyArgsOptions) (string, error)

func (*TerraformRunnerOptions) RunDestroy added in v1.2.1

func (*TerraformRunnerOptions) RunDestroyE added in v1.2.1

func (t *TerraformRunnerOptions) RunDestroyE(binary string, args *DestroyArgsOptions) (string, error)

func (*TerraformRunnerOptions) RunInit added in v1.2.1

func (*TerraformRunnerOptions) RunInitE added in v1.2.1

func (t *TerraformRunnerOptions) RunInitE(binary string, args *InitArgsOptions) (string, error)

func (*TerraformRunnerOptions) RunPlan added in v1.2.1

func (*TerraformRunnerOptions) RunPlanE added in v1.2.1

func (t *TerraformRunnerOptions) RunPlanE(binary string, args *PlanArgsOptions) (string, error)

type TerragruntConfig added in v1.2.1

type TerragruntConfig interface {
	GetConfig() []string
}

type TerragruntOptions added in v1.2.1

type TerragruntOptions struct {
	// The path to the Terragrunt config file. Default is terragrunt.hcl.
	Config string `json:"terragrunt-config,omitempty"`

	// Write terragrunt-debug.tfvars to working folder to help root-cause issues.
	Debug bool `json:"terragrunt-debug,omitempty"`

	// When this flag is set Terragrunt will not update the remote state bucket.
	DisableBucketUpdate bool `json:"terragrunt-disable-bucket-update,omitempty"`

	// When this flag is set, Terragrunt will not validate the terraform command.
	DisableCommandValidation bool `json:"terragrunt-disable-command-validation,omitempty"`

	// The path where to download Terraform code. Default is .terragrunt-cache in the working directory.
	DownloadDir string `json:"terragrunt-download-dir,omitempty"`

	// Unix-style glob of directories to exclude when running *-all commands.
	ExcludeDir string `json:"terragrunt-exclude-dir,omitempty"`

	// When this flag is set Terragrunt will fail if the remote state bucket needs to be created.
	FailOnStateBucketCreation bool `json:"terragrunt-fail-on-state-bucket-creation,omitempty"`

	// The option fetchs dependency output directly from the state file instead of init dependencies and running terraform on them.
	FetchDependencyOutputFromState bool `json:"terragrunt-fetch-dependency-output-from-state,omitempty"`

	// Session duration for IAM Assume Role session.
	IamAssumeRoleDuration string `json:"terragrunt-iam-assume-role-duration,omitempty"`

	// Name for the IAM Assummed Role session.
	IamAssumeRoleSessionName string `json:"terragrunt-iam-assume-role-session-name,omitempty"`

	// Assume the specified IAM role before executing Terraform.
	IamRole string `json:"terragrunt-iam-role,omitempty"`

	// *-all commands continue processing components even if a dependency fails.
	IgnoreDependencyErrors bool `json:"terragrunt-ignore-dependency-errors,omitempty"`

	// *-all commands will be run disregarding the dependencies.
	IgnoreDependencyOrder bool `json:"terragrunt-ignore-dependency-order,omitempty"`

	// *-all commands will not attempt to include external dependencies.
	IgnoreExternalDependencies bool `json:"terragrunt-ignore-external-dependencies,omitempty"`

	// Unix-style glob of directories to include when running *-all commands.
	IncludeDir string `json:"terragrunt-include-dir,omitempty"`

	// *-all commands will include external dependencies.
	IncludeExternalDependencies bool `json:"terragrunt-include-external-dependencies,omitempty"`

	// When this flag is set output from Terraform sub-commands is prefixed with module path.
	IncludeModulePrefix bool `json:"terragrunt-include-module-prefix,omitempty"`

	// If specified, Terragrunt will output its logs in JSON format.
	JSONLog bool `json:"terragrunt-json-log,omitempty"`

	// Sets the logging level for Terragrunt. Supported levels: panic, fatal, error, warn, info, debug, trace.
	LogLevel string `json:"terragrunt-log-level,omitempty"`

	// If flag is set, 'run-all' will only run the command against Terragrunt modules that include the specified file.
	ModulesThatInclude string `json:"terragrunt-modules-that-include,omitempty"`

	// Don't automatically append -auto-approve to the underlying Terraform commands run with 'run-all'.
	NoAutoApprove bool `json:"terragrunt-no-auto-approve,omitempty"`

	// Don't automatically run 'terraform init' during other terragrunt commands. You must run 'terragrunt init' manually.
	NoAutoInit bool `json:"terragrunt-no-auto-init,omitempty"`

	// Don't automatically re-run command in case of transient errors.
	NoAutoRetry bool `json:"terragrunt-no-auto-retry,omitempty"`

	// If specified, Terragrunt output won't contain any color.
	NoColor bool `json:"terragrunt-no-color,omitempty"`

	// Assume "yes" for all prompts.
	NonInteractive bool `json:"terragrunt-non-interactive,omitempty"`

	// *-all commands parallelism set to at most N modules.
	Parallelism int `json:"terragrunt-parallelism,omitempty"`

	// Download Terraform configurations from the specified source into a temporary folder, and run Terraform in that temporary folder.
	Source string `json:"terragrunt-source,omitempty"`

	// Replace any source URL (including the source URL of a config pulled in with dependency blocks) that has root source with dest.
	SourceMap string `json:"terragrunt-source-map,omitempty"`

	// Delete the contents of the temporary folder to clear out any old, cached source code before downloading new source code into it.
	SourceUpdate bool `json:"terragrunt-source-update,omitempty"`

	// If flag is set, only modules under the directories passed in with '--terragrunt-include-dir' will be included.
	StrictInclude bool `json:"terragrunt-strict-include,omitempty"`

	// If specified, Terragrunt will wrap Terraform stdout and stderr in JSON.
	TfLogsToJSON bool `json:"terragrunt-tf-logs-to-json,omitempty"`

	// Path to the Terraform binary. Default is terraform (on PATH).
	TfPath string `json:"terragrunt-tfpath,omitempty"`

	// Enables caching of includes during partial parsing operations. Will also be used for the --terragrunt-iam-role option if provided.
	UsePartialParseConfigCache bool `json:"terragrunt-use-partial-parse-config-cache,omitempty"`
}

func (*TerragruntOptions) GetConfig added in v1.2.1

func (tg *TerragruntOptions) GetConfig() []string

type TerragruntRunnerOptions added in v1.2.1

type TerragruntRunnerOptions struct {
	TfGlobalOptions TfGlobalOptions
	TgConfig        TerragruntConfig
	// contains filtered or unexported fields
}

func (*TerragruntRunnerOptions) RunApply added in v1.2.1

func (*TerragruntRunnerOptions) RunApplyE added in v1.2.1

func (tg *TerragruntRunnerOptions) RunApplyE(binary string, args *ApplyArgsOptions) (string, error)

func (*TerragruntRunnerOptions) RunDestroy added in v1.2.1

func (*TerragruntRunnerOptions) RunDestroyE added in v1.2.1

func (tg *TerragruntRunnerOptions) RunDestroyE(binary string, args *DestroyArgsOptions) (string, error)

func (*TerragruntRunnerOptions) RunInit added in v1.2.1

func (*TerragruntRunnerOptions) RunInitE added in v1.2.1

func (tg *TerragruntRunnerOptions) RunInitE(binary string, args *InitArgsOptions) (string, error)

func (*TerragruntRunnerOptions) RunPlan added in v1.2.1

func (*TerragruntRunnerOptions) RunPlanE added in v1.2.1

func (tg *TerragruntRunnerOptions) RunPlanE(binary string, args *PlanArgsOptions) (string, error)

type TfGlobalOptions

type TfGlobalOptions interface {
	GetModulePath() string
	GetTerraformVersion() string
	GetEnableSSHPrivateGit() bool
	GetCustomContainerImage() string
	GetInvalidateCache() bool
	IsAutoDetectTFVarsFromHost() bool
	IsAutoDetectAWSKeysFromHost() bool
	IsMirrorAllEnvVarsFromHost() bool
	GetEnvVarsToInjectByKeyFromHost() []string
	TfGlobalValidator
}

func WithOptions

func WithOptions(td *terradagger.TD, o *TfOptions) TfGlobalOptions

WithOptions is a function that returns a TfGlobalOptions with the options passed in. It's a constructor for the TfGlobalOptions

type TfGlobalValidator added in v1.2.1

type TfGlobalValidator interface {
	IsModulePathValid() error
	ModulePathHasTerraformCode() error
	ModulePathHasTerragruntHCL() error
}

type TfLifecycleCMD added in v1.2.1

type TfLifecycleCMD struct{}

func (*TfLifecycleCMD) GenerateTFInitCommandStr added in v1.2.1

func (t *TfLifecycleCMD) GenerateTFInitCommandStr(options *GenerateTFInitCMDStrOptions) (string, error)

func (*TfLifecycleCMD) GetApplyCommand added in v1.2.1

func (t *TfLifecycleCMD) GetApplyCommand() string

func (*TfLifecycleCMD) GetDestroyCommand added in v1.2.1

func (t *TfLifecycleCMD) GetDestroyCommand() string

func (*TfLifecycleCMD) GetEntryPoint added in v1.2.1

func (t *TfLifecycleCMD) GetEntryPoint(iaacTool string) string

func (*TfLifecycleCMD) GetInitCommand added in v1.2.1

func (t *TfLifecycleCMD) GetInitCommand() string

func (*TfLifecycleCMD) GetPlanCommand added in v1.2.1

func (t *TfLifecycleCMD) GetPlanCommand() string

func (*TfLifecycleCMD) GetTerraformLifecycleCMDString added in v1.2.1

func (t *TfLifecycleCMD) GetTerraformLifecycleCMDString(options *GetTerraformLifecycleCMDStringOptions) (string, error)

func (*TfLifecycleCMD) GetValidateCommand added in v1.2.1

func (t *TfLifecycleCMD) GetValidateCommand() string

type TfLifecycleCMDResolver added in v1.2.1

type TfLifecycleCMDResolver interface {
	GetTerraformLifecycleCMDString(options *GetTerraformLifecycleCMDStringOptions) (string, error)
	GenerateTFInitCommandStr(options *GenerateTFInitCMDStrOptions) (string, error)
}

type TfOptions

type TfOptions struct {
	// ModulePath is the directory of the terraform code
	ModulePath string
	// TerraformVersion is the version of terraform to use
	TerraformVersion string
	// MirrorAllEnvVarsFromHost is a flag to scan the environment variables and inject them into the terraform code
	// The variables that'll be injected are the ones that start with TF_VAR_
	MirrorAllEnvVarsFromHost bool
	// AutoDetectTFVarsFromHost is a flag to scan the environment variables and inject them into the terraform code
	AutoDetectTFVarsFromHost bool
	// AutoDetectAWSKeysFromHost is a flag to scan the environment variables and inject them into the terraform code
	AutoDetectAWSKeysFromHost bool
	// CustomContainerImage is the custom image to use for the terraform container
	CustomContainerImage string
	// EnableSSHPrivateGit is a flag to use SSH for the modules
	EnableSSHPrivateGit bool
	// InvalidateCache is a flag to invalidate the cache
	InvalidateCache bool
	// EnvVarsToInjectByKeyFromHost is a slice of environment variables to inject into the container
	EnvVarsToInjectByKeyFromHost []string
}

Jump to

Keyboard shortcuts

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