Documentation
¶
Index ¶
- Variables
- func AwsGetEksToken(ctx context.Context, name string, region string) error
- func Banner()
- func ByCommandName(a, b *cli.Command) int
- func Check(ctx context.Context, p *CommandParams)
- func CheckAITelemetry(ctx context.Context, p *CommandParams) error
- func CheckInstallReadiness(ctx context.Context, p *CommandParams) error
- func Clean(ctx context.Context, p *CommandParams) error
- func Cleanup(ctx context.Context, p *CommandParams) error
- func CleanupTerminatingPods(ctx context.Context, p *CommandParams, timeoutMinutes int) error
- func ClusterInfo(ctx context.Context, p *CommandParams) error
- func ClusterLogin(ctx context.Context, path string, p *CommandParams) error
- func Confirm(ctx context.Context, msg string, p *CommandParams) error
- func Export(ctx context.Context, p *CommandParams) error
- func ForceCleanup(ctx context.Context, p *CommandParams) error
- func Install(ctx context.Context, p *CommandParams, resumeFrom string) (err error)
- func LocalInstallPreflight(p *CommandParams) error
- func NewCliCommand(deps CliDependencies, p AppServiceParams) *cli.Command
- func Preflight(ctx context.Context, p *CommandParams) error
- func PrepareAccount(ctx context.Context, p *CommandParams) error
- func RefreshSecrets(ctx context.Context, p *CommandParams) error
- func Render(ctx context.Context, path string, p *CommandParams) error
- func ReportAppDeliveryReadiness(ctx context.Context, p *CommandParams)
- func ReportModelWarmerStatus(ctx context.Context, p *CommandParams)
- func Restart(ctx context.Context, res string, ns string, name string, p *CommandParams) error
- func RunAppService(p AppServiceParams)
- func TfApply(ctx context.Context, stage string, p *CommandParams) error
- func TfApplyTargeted(ctx context.Context, stage string, p *CommandParams, targets []string) error
- func TfApplyWithRetry(ctx context.Context, stage string, p *CommandParams, maxRetries int, ...) error
- func TfCreateBackend(ctx context.Context, p *CommandParams) error
- func TfDestroy(ctx context.Context, stage string, p *CommandParams) error
- func TfDestroyBackend(ctx context.Context, p *CommandParams) error
- func TfDestroyWithRetry(ctx context.Context, stage string, p *CommandParams, maxRetries int, ...) error
- func TfForceUnlock(ctx context.Context, stage string, lockID string, p *CommandParams) error
- func TfFormat(ctx context.Context, stage string, p *CommandParams) error
- func TfFormatAll(ctx context.Context, p *CommandParams) error
- func TfImport(ctx context.Context, stage string, address string, id string, p *CommandParams) error
- func TfInit(ctx context.Context, stage string, p *CommandParams) error
- func TfInitAll(ctx context.Context, p *CommandParams) error
- func TfOutput(ctx context.Context, stage string, p *CommandParams) error
- func TfPlan(ctx context.Context, stage string, p *CommandParams) error
- func TfRefresh(ctx context.Context, stage string, p *CommandParams) error
- func TfRefreshAll(ctx context.Context, p *CommandParams) error
- func TfRefreshWithUnlock(ctx context.Context, stage string, p *CommandParams) error
- func TfStateBackendExists(ctx context.Context, p *CommandParams) (bool, error)
- func TfStateInit(ctx context.Context, stage string, p *CommandParams) error
- func TfStateList(ctx context.Context, stage string, filters []string, p *CommandParams) error
- func TfStateRemove(ctx context.Context, stage string, addresses []string, p *CommandParams) error
- func TfStateShow(ctx context.Context, stage string, addresses []string, p *CommandParams) error
- func TfValidate(ctx context.Context, stage string, p *CommandParams) (int, error)
- func TfVersion(ctx context.Context, p *CommandParams) error
- func Version(version string, buildDate string)
- type AppService
- type AppServiceParams
- type AwsCommandParams
- type AwsCommandResult
- type CliDependencies
- type CommandParams
- type RootCommandParams
- type RootCommandResult
- func NewRootAwsCommand(cmds AwsCommandParams) RootCommandResult
- func NewRootCheckCommand(p *CommandParams) RootCommandResult
- func NewRootCleanCommand(p *CommandParams) RootCommandResult
- func NewRootExportCommand(p *CommandParams) RootCommandResult
- func NewRootInfoCommand(p *CommandParams) RootCommandResult
- func NewRootInstallCommand(p *CommandParams) RootCommandResult
- func NewRootInternalCommand(p *CommandParams) RootCommandResult
- func NewRootLoginCommand(p *CommandParams) RootCommandResult
- func NewRootRefreshSecretsCommand(p *CommandParams) RootCommandResult
- func NewRootRenderCommand(p *CommandParams) RootCommandResult
- func NewRootRestartCommand(p *CommandParams) RootCommandResult
- func NewRootTofuCommand(cmds TfCommandParams, p *CommandParams) RootCommandResult
- type TfCommandParams
- type TfCommandResult
- func NewTfApplyCommand(p *CommandParams) TfCommandResult
- func NewTfDestroyCommand(p *CommandParams) TfCommandResult
- func NewTfForceUnlockCommand(p *CommandParams) TfCommandResult
- func NewTfFormatAllCommand(p *CommandParams) TfCommandResult
- func NewTfFormatCommand(p *CommandParams) TfCommandResult
- func NewTfImportCommand(p *CommandParams) TfCommandResult
- func NewTfInitAllCommand(p *CommandParams) TfCommandResult
- func NewTfInitCommand(p *CommandParams) TfCommandResult
- func NewTfOutputCommand(p *CommandParams) TfCommandResult
- func NewTfPlanCommand(p *CommandParams) TfCommandResult
- func NewTfRefreshAllCommand(p *CommandParams) TfCommandResult
- func NewTfRefreshCommand(p *CommandParams) TfCommandResult
- func NewTfStateCommand(p *CommandParams) TfCommandResult
- func NewTfValidateCommand(p *CommandParams) TfCommandResult
- func NewTfVersionCommand(p *CommandParams) TfCommandResult
Constants ¶
This section is empty.
Variables ¶
var RootCommandsModule = fx.Module("rootCmds", fx.Provide( func() *CommandParams { return NewCommandParams(time.Now()) }, NewRootInstallCommand, NewRootCleanCommand, NewRootLoginCommand, NewRootInfoCommand, NewRootCheckCommand, NewRootRenderCommand, NewRootRefreshSecretsCommand, NewRootExportCommand, NewRootRestartCommand, NewRootTofuCommand, NewRootAwsCommand, NewRootInternalCommand, ), tfCommandsModule, awsCommandsModule, )
RootCommandsModule defines the root commands module for dependency injection. It provides all root-level commands and their dependencies.
Functions ¶
func AwsGetEksToken ¶
AwsGetEksToken retrieves an authentication token for an EKS cluster. This function is used by kubeconfig exec to request the token, similar to `aws eks get-token`.
Parameters:
- ctx: The context for the operation.
- name: The name of the EKS cluster.
- region: The AWS region where the EKS cluster is located.
Returns:
- error: An error if the token retrieval fails, otherwise nil.
func ByCommandName ¶
ByCommandName compares two CLI commands by their names.
Parameters:
- a: The first CLI command.
- b: The second CLI command.
Returns:
- int: A negative number if a.Name < b.Name, zero if a.Name == b.Name, or a positive number if a.Name > b.Name.
func Check ¶
func Check(ctx context.Context, p *CommandParams)
Check verifies the dependencies required for Quartz installation.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
func CheckAITelemetry ¶ added in v1.1.0
func CheckAITelemetry(ctx context.Context, p *CommandParams) error
func CheckInstallReadiness ¶ added in v1.1.0
func CheckInstallReadiness(ctx context.Context, p *CommandParams) error
func Clean ¶
func Clean(ctx context.Context, p *CommandParams) error
Clean tears down the Quartz environment, including all managed resources and data. This includes refreshing OpenTofu states, destroying resources, and cleaning up. Errors during individual stage destroys are collected and reported but do not abort remaining stages, ensuring maximum cleanup even with partial failures.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the cleanup fails, otherwise nil.
func Cleanup ¶
func Cleanup(ctx context.Context, p *CommandParams) error
Cleanup removes temporary files created by the installer.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if cleanup fails, otherwise nil.
func CleanupTerminatingPods ¶ added in v1.0.7
func CleanupTerminatingPods(ctx context.Context, p *CommandParams, timeoutMinutes int) error
CleanupTerminatingPods force-deletes pods that have been stuck in Terminating state for longer than the specified timeout. This is useful for cleaning up pods that cannot terminate due to CNI or other infrastructure issues.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
- timeoutMinutes: Minutes a pod must be stuck before force-deleting.
Returns:
- error: An error if the cleanup fails, otherwise nil.
func ClusterInfo ¶
func ClusterInfo(ctx context.Context, p *CommandParams) error
ClusterInfo retrieves and displays information about the Quartz cluster.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if retrieving cluster information fails, otherwise nil.
func ClusterLogin ¶
func ClusterLogin(ctx context.Context, path string, p *CommandParams) error
ClusterLogin generates a kubeconfig file for the Quartz environment.
Parameters:
- ctx: The context for the operation.
- path: The file path where the kubeconfig will be written.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if generating the kubeconfig fails, otherwise nil.
func Confirm ¶
func Confirm(ctx context.Context, msg string, p *CommandParams) error
Confirm prompts the user for confirmation before proceeding with an operation.
Parameters:
- ctx: The context for the operation.
- msg: The confirmation message to display.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the user does not confirm, otherwise nil.
func Export ¶
func Export(ctx context.Context, p *CommandParams) error
Export saves the configured Kubernetes resources to YAML files.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if exporting resources fails, otherwise nil.
func ForceCleanup ¶
func ForceCleanup(ctx context.Context, p *CommandParams) error
ForceCleanup performs post-delete cleanup, including removing temporary files and destroying the OpenTofu state bucket.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the cleanup fails, otherwise nil.
func Install ¶
func Install(ctx context.Context, p *CommandParams, resumeFrom string) (err error)
Install sets up the Quartz environment by initializing and applying all stages. This includes preparing the account, creating the OpenTofu backend, and applying configurations.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the installation fails, otherwise nil.
func LocalInstallPreflight ¶ added in v1.1.0
func LocalInstallPreflight(p *CommandParams) error
LocalInstallPreflight keeps local install prerequisites from failing late in OpenTofu. It never deletes logs automatically; it only compresses large old *.tf.log files and warns when the filesystem is still tight.
func NewCliCommand ¶
func NewCliCommand(deps CliDependencies, p AppServiceParams) *cli.Command
NewCliCommand creates a new CLI command with the provided dependencies.
Parameters:
- deps: CliDependencies containing the required dependencies.
Returns:
- *cli.Command: The root CLI command for the Quartz tool.
func Preflight ¶ added in v1.1.0
func Preflight(ctx context.Context, p *CommandParams) error
Preflight validates cloud credentials and connectivity before starting the install. Fails fast if IAM credentials are invalid or the cloud provider is unreachable.
func PrepareAccount ¶
func PrepareAccount(ctx context.Context, p *CommandParams) error
PrepareAccount prepares the cloud account for Quartz operations.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if preparing the account fails, otherwise nil.
func RefreshSecrets ¶
func RefreshSecrets(ctx context.Context, p *CommandParams) error
RefreshSecrets triggers an immediate refresh of all external secrets.
Parameters:
- ctx: The context for the operation.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if refreshing secrets fails, otherwise nil.
func Render ¶
func Render(ctx context.Context, path string, p *CommandParams) error
Render writes the full configuration to the specified file path.
Parameters:
- ctx: The context for the operation.
- path: The file path where the configuration will be written.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if the rendering fails, otherwise nil.
func ReportAppDeliveryReadiness ¶ added in v1.1.0
func ReportAppDeliveryReadiness(ctx context.Context, p *CommandParams)
func ReportModelWarmerStatus ¶ added in v1.1.0
func ReportModelWarmerStatus(ctx context.Context, p *CommandParams)
func Restart ¶
Restart restarts a Kubernetes resource in the specified namespace.
Parameters:
- ctx: The context for the operation.
- res: The resource type to restart (e.g., deployment, daemonset).
- ns: The namespace of the resource.
- name: The name of the resource.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- error: An error if restarting the resource fails, otherwise nil.
func RunAppService ¶
func RunAppService(p AppServiceParams)
RunAppService initializes and runs the application service using Uber's Fx framework. It sets up dependency injection, logging, and lifecycle hooks for the application.
func TfApply ¶
func TfApply(ctx context.Context, stage string, p *CommandParams) error
TfApply runs `tofu apply` for a specific stage.
func TfApplyTargeted ¶ added in v1.1.0
TfApplyTargeted runs `tofu apply` for a stage restricted to the given resource addresses (-target). It converges a stage's co-resources when a full apply is blocked — specifically when the stage's bootstrap Helm release has been adopted and re-versioned by Flux, which aborts an untargeted plan at plan time before any resource can apply. Stage post-checks are intentionally skipped: a targeted secret/config convergence does not change the cluster topology those checks validate, and re-running them (e.g. the 1200s istiod gate) would needlessly stall a day-2 config change.
func TfApplyWithRetry ¶ added in v1.1.0
func TfApplyWithRetry(ctx context.Context, stage string, p *CommandParams, maxRetries int, retryDelay time.Duration) error
TfApplyWithRetry attempts to apply a stage with retry logic for transient failures. It retries on known transient errors (state locks, timeouts, API throttling) with exponential backoff between attempts.
func TfCreateBackend ¶
func TfCreateBackend(ctx context.Context, p *CommandParams) error
TfCreateBackend creates the OpenTofu state backend.
func TfDestroy ¶
func TfDestroy(ctx context.Context, stage string, p *CommandParams) error
TfDestroy runs `tofu destroy` for a specific stage.
func TfDestroyBackend ¶
func TfDestroyBackend(ctx context.Context, p *CommandParams) error
TfDestroyBackend destroys the OpenTofu state backend.
func TfDestroyWithRetry ¶ added in v1.0.7
func TfDestroyWithRetry(ctx context.Context, stage string, p *CommandParams, maxRetries int, retryDelay time.Duration) error
TfDestroyWithRetry attempts to destroy a stage with retry logic for transient failures. It retries on known transient errors (dependency violations, timeouts) with a simple delay between attempts. Cleanup of blocking resources is handled by Helm pre-delete hooks running in-cluster.
Parameters:
- ctx: The context for the operation.
- stage: The stage ID to destroy.
- p: *CommandParams containing configuration and runtime parameters.
- maxRetries: Maximum number of retry attempts.
- retryDelay: Duration to wait between retries.
Returns:
- error: An error if all attempts fail, otherwise nil.
func TfForceUnlock ¶ added in v1.1.0
TfForceUnlock runs `tofu force-unlock` for a specific stage, releasing a stale state lock left behind by an interrupted run.
func TfFormat ¶
func TfFormat(ctx context.Context, stage string, p *CommandParams) error
TfFormat runs `tofu fmt` for a specific stage.
func TfFormatAll ¶
func TfFormatAll(ctx context.Context, p *CommandParams) error
TfFormatAll runs `tofu fmt` for all stages.
func TfImport ¶ added in v1.1.0
TfImport runs `tofu import` for a specific stage, associating the resource at the given configuration address with its real-world ID.
func TfInit ¶
func TfInit(ctx context.Context, stage string, p *CommandParams) error
TfInit runs `tofu init` for a specific stage.
func TfInitAll ¶
func TfInitAll(ctx context.Context, p *CommandParams) error
TfInitAll runs `tofu init` for all stages.
func TfOutput ¶
func TfOutput(ctx context.Context, stage string, p *CommandParams) error
TfOutput retrieves the OpenTofu output for a specific stage.
func TfPlan ¶
func TfPlan(ctx context.Context, stage string, p *CommandParams) error
TfPlan runs `tofu plan` for a specific stage.
func TfRefresh ¶
func TfRefresh(ctx context.Context, stage string, p *CommandParams) error
TfRefresh runs `tofu refresh` for a specific stage.
func TfRefreshAll ¶
func TfRefreshAll(ctx context.Context, p *CommandParams) error
TfRefreshAll runs `tofu refresh` for all stages.
func TfRefreshWithUnlock ¶ added in v1.1.0
func TfRefreshWithUnlock(ctx context.Context, stage string, p *CommandParams) error
TfRefreshWithUnlock runs `tofu refresh` for a stage with automatic state lock recovery. If a stale lock is detected, it force-unlocks and retries once.
func TfStateBackendExists ¶ added in v1.1.0
func TfStateBackendExists(ctx context.Context, p *CommandParams) (bool, error)
TfStateBackendExists reports whether the OpenTofu state backend still exists. Used to detect an already-destroyed environment so clean can short-circuit.
func TfStateInit ¶ added in v1.1.0
func TfStateInit(ctx context.Context, stage string, p *CommandParams) error
TfStateInit runs a backend-only `tofu init` for a stage prior to a state operation. Unlike TfInit it deliberately skips the cluster-login step in tfStagePrep: state inspection/removal must work even when the stage's Kubernetes endpoint is gone (the exact situation where `state rm` is needed to drop orphaned resources).
func TfStateList ¶ added in v1.1.0
TfStateList prints the resource addresses recorded in a stage's state, optionally filtered by case-insensitive substring match.
func TfStateRemove ¶ added in v1.1.0
TfStateRemove removes the named resources from a stage's state without destroying the underlying infrastructure. It is primarily used to drop orphaned resources (e.g. a helm_release pointing at an already-deleted cluster) so a subsequent destroy/clean can proceed.
func TfStateShow ¶ added in v1.1.0
TfStateShow prints the attributes of resources in a stage's state with sensitive values redacted. When no addresses are supplied every resource is shown.
func TfValidate ¶
TfValidate runs `tofu validate` for a specific stage.
Types ¶
type AppService ¶
type AppService struct {
// contains filtered or unexported fields
}
AppService represents the main application service that manages the CLI command execution and the lifecycle of the application.
func NewAppService ¶
func NewAppService(app *cli.Command, sd fx.Shutdowner) *AppService
NewAppService creates a new instance of AppService with the provided CLI command and shutdowner.
func (*AppService) Start ¶
func (svc *AppService) Start(args []string) error
Start begins the execution of the CLI application. It manages the lifecycle of the application and listens for shutdown signals or errors during execution.
func (*AppService) Stop ¶
func (svc *AppService) Stop() error
Stop waits for all goroutines to finish and returns any error encountered during execution.
type AppServiceParams ¶
type AwsCommandParams ¶
AwsCommandParams represents the input parameters for AWS-related commands. It is used to group AWS commands for dependency injection.
type AwsCommandResult ¶
AwsCommandResult represents the output result for an AWS command. It is used to group AWS commands for dependency injection.
func NewGetEksTokenCommand ¶
func NewGetEksTokenCommand() AwsCommandResult
NewGetEksTokenCommand creates a CLI command for retrieving an EKS authentication token.
Returns:
- AwsCommandResult containing the CLI command for retrieving the token.
type CliDependencies ¶
type CliDependencies struct {
fx.In
Params *CommandParams
Root RootCommandParams
}
CliDependencies contains the dependencies required to initialize the CLI. It is used to inject parameters, root commands, and build metadata.
Fields:
- Params: CommandParams for managing CLI configuration and secrets.
- Root: RootCommandParams containing the list of root-level commands.
- Version: The version of the CLI.
- BuildDate: The build date of the CLI.
type CommandParams ¶
type CommandParams struct {
// contains filtered or unexported fields
}
CommandParams holds the configuration and runtime parameters for CLI commands.
Fields:
- configFile: Path to the configuration file.
- secretsFile: Path to the secrets file.
- startTime: The time when the command execution started.
- settings: Lazy-loaded settings from the configuration file.
- provider: Lazy-loaded provider factory for managing resources.
func NewCommandParams ¶
func NewCommandParams(startTime time.Time) *CommandParams
NewCommandParams creates a new instance of CommandParams.
Parameters:
- startTime: The time when the command execution started.
Returns:
- *CommandParams: A new instance of CommandParams.
func (*CommandParams) Provider ¶
func (p *CommandParams) Provider() *provider.ProviderFactory
Provider lazy loads the provider factory.
Returns:
- *provider.ProviderFactory: The provider factory for managing resources.
func (*CommandParams) SetConfig ¶
func (p *CommandParams) SetConfig(configFile string)
SetConfig sets the configuration file path for the command parameters.
Parameters:
- configFile: The path to the configuration file.
func (*CommandParams) SetSecrets ¶
func (p *CommandParams) SetSecrets(secretsFile string)
SetSecrets sets the secrets file path for the command parameters.
Parameters:
- secretsFile: The path to the secrets file.
func (*CommandParams) Settings ¶
func (p *CommandParams) Settings() *config.Settings
Settings lazy loads the settings from the configuration file.
Returns:
- *config.Settings: The loaded settings from the configuration file.
type RootCommandParams ¶
RootCommandParams represents the input parameters for root-level commands. It is used to group root commands for dependency injection.
type RootCommandResult ¶
RootCommandResult represents the output result for a root-level command. It is used to group root commands for dependency injection.
func NewRootAwsCommand ¶
func NewRootAwsCommand(cmds AwsCommandParams) RootCommandResult
NewRootAwsCommand creates the root AWS CLI command. It organizes and returns all AWS-related subcommands.
Parameters:
- cmds: AwsCommandParams containing the list of AWS subcommands.
Returns:
- RootCommandResult containing the root AWS CLI command.
func NewRootCheckCommand ¶
func NewRootCheckCommand(p *CommandParams) RootCommandResult
func NewRootCleanCommand ¶
func NewRootCleanCommand(p *CommandParams) RootCommandResult
NewRootCleanCommand creates the "clean" root command for the CLI. This command performs a full cleanup or teardown of the Quartz system.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- RootCommandResult containing the "clean" CLI command.
func NewRootExportCommand ¶
func NewRootExportCommand(p *CommandParams) RootCommandResult
func NewRootInfoCommand ¶
func NewRootInfoCommand(p *CommandParams) RootCommandResult
func NewRootInstallCommand ¶
func NewRootInstallCommand(p *CommandParams) RootCommandResult
NewRootInstallCommand creates the "install" root command for the CLI. This command performs a full installation or update of the Quartz system.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- RootCommandResult containing the "install" CLI command.
func NewRootInternalCommand ¶
func NewRootInternalCommand(p *CommandParams) RootCommandResult
NewRootInternalCommand creates the "internal" root command for the CLI. This command is hidden and is used for internal operations such as force cleanup.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- RootCommandResult containing the "internal" CLI command.
func NewRootLoginCommand ¶
func NewRootLoginCommand(p *CommandParams) RootCommandResult
func NewRootRefreshSecretsCommand ¶
func NewRootRefreshSecretsCommand(p *CommandParams) RootCommandResult
func NewRootRenderCommand ¶
func NewRootRenderCommand(p *CommandParams) RootCommandResult
func NewRootRestartCommand ¶
func NewRootRestartCommand(p *CommandParams) RootCommandResult
func NewRootTofuCommand ¶ added in v1.1.0
func NewRootTofuCommand(cmds TfCommandParams, p *CommandParams) RootCommandResult
NewRootTofuCommand creates the "tofu" (aliased as "tf") root command for the CLI. This command provides subcommands for managing OpenTofu stages.
Parameters:
- cmds: TfCommandParams containing the list of OpenTofu subcommands.
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- RootCommandResult containing the "tofu"/"tf" CLI command.
type TfCommandParams ¶
TfCommandParams represents the input parameters for OpenTofu-related commands. It is used to group OpenTofu commands for dependency injection.
type TfCommandResult ¶
TfCommandResult represents the output result for an OpenTofu command. It is used to group OpenTofu commands for dependency injection.
func NewTfApplyCommand ¶
func NewTfApplyCommand(p *CommandParams) TfCommandResult
NewTfApplyCommand creates a CLI command for running `tofu apply` on a specific stage.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "apply" CLI command.
func NewTfDestroyCommand ¶
func NewTfDestroyCommand(p *CommandParams) TfCommandResult
NewTfDestroyCommand creates a CLI command for running `tofu destroy` on a specific stage.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "destroy" CLI command.
func NewTfForceUnlockCommand ¶ added in v1.1.0
func NewTfForceUnlockCommand(p *CommandParams) TfCommandResult
NewTfForceUnlockCommand creates a CLI command for running `tofu force-unlock` on a specific stage. This releases a stale state lock left behind by an interrupted run so that subsequent operations can proceed without manually editing the backend lock table.
func NewTfFormatAllCommand ¶
func NewTfFormatAllCommand(p *CommandParams) TfCommandResult
NewTfFormatAllCommand creates a CLI command for running `tofu fmt` on all stages.
func NewTfFormatCommand ¶
func NewTfFormatCommand(p *CommandParams) TfCommandResult
NewTfFormatCommand creates a CLI command for running `tofu fmt` on a specific stage.
func NewTfImportCommand ¶ added in v1.1.0
func NewTfImportCommand(p *CommandParams) TfCommandResult
NewTfImportCommand creates a CLI command for running `tofu import` on a specific stage. This brings an existing infrastructure object under OpenTofu management, which is useful for reconciling state after an interrupted apply left a real resource created but unrecorded (e.g. an EKS OIDC association that succeeded just before the process died).
func NewTfInitAllCommand ¶
func NewTfInitAllCommand(p *CommandParams) TfCommandResult
NewTfInitAllCommand creates a CLI command for running `tofu init` on all stages.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "init-all" CLI command.
func NewTfInitCommand ¶
func NewTfInitCommand(p *CommandParams) TfCommandResult
NewTfInitCommand creates a CLI command for running `tofu init` on a specific stage.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "init" CLI command.
func NewTfOutputCommand ¶
func NewTfOutputCommand(p *CommandParams) TfCommandResult
NewTfOutputCommand creates a CLI command for retrieving OpenTofu output for a specific stage.
func NewTfPlanCommand ¶
func NewTfPlanCommand(p *CommandParams) TfCommandResult
NewTfPlanCommand creates a CLI command for running `tofu plan` on a specific stage.
Parameters:
- p: *CommandParams containing configuration and runtime parameters.
Returns:
- TfCommandResult containing the "plan" CLI command.
func NewTfRefreshAllCommand ¶
func NewTfRefreshAllCommand(p *CommandParams) TfCommandResult
NewTfRefreshAllCommand creates a CLI command for running `tofu refresh` on all stages.
func NewTfRefreshCommand ¶
func NewTfRefreshCommand(p *CommandParams) TfCommandResult
NewTfRefreshCommand creates a CLI command for running `tofu refresh` on a specific stage.
func NewTfStateCommand ¶ added in v1.1.0
func NewTfStateCommand(p *CommandParams) TfCommandResult
NewTfStateCommand creates the "state" subcommand group for inspecting and modifying the OpenTofu state of an individual stage. It mirrors the native `tofu state` workflow (list/show/rm) but routes through quartzctl so the correct backend, providers, and environment for a stage are resolved automatically. The `show` subcommand redacts sensitive attribute values so state can be inspected without leaking secrets.
func NewTfValidateCommand ¶
func NewTfValidateCommand(p *CommandParams) TfCommandResult
NewTfValidateCommand creates a CLI command for running `tofu validate` on a specific stage.
func NewTfVersionCommand ¶
func NewTfVersionCommand(p *CommandParams) TfCommandResult
NewTfVersionCommand creates a CLI command for checking and displaying the OpenTofu version.