Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithTerraformCommandHook(ctx context.Context, fn RunShellCommandFunc) context.Context
- func ExplainError(err error) string
- func GetExitCode(err error) (int, error)
- func GitLastReleaseTag(ctx context.Context, opts *options.TerragruntOptions, gitRepo *url.URL) (string, error)
- func GitRepoTags(ctx context.Context, opts *options.TerragruntOptions, gitRepo *url.URL) ([]string, error)
- func GitTopLevelDir(ctx context.Context, terragruntOptions *options.TerragruntOptions, path string) (string, error)
- func PrepareConsole(terragruntOptions *options.TerragruntOptions)
- func PromptUserForInput(prompt string, terragruntOptions *options.TerragruntOptions) (string, error)
- func PromptUserForYesNo(prompt string, terragruntOptions *options.TerragruntOptions) (bool, error)
- func RegisterSignalHandler(notifyFn func(os.Signal), sigs ...os.Signal)
- func RunShellCommand(ctx context.Context, terragruntOptions *options.TerragruntOptions, ...) error
- func RunTerraformCommand(ctx context.Context, terragruntOptions *options.TerragruntOptions, ...) error
- type CmdOutput
- type ProcessExecutionError
- type RunShellCommandFunc
- type SignalsForwarder
Constants ¶
const SignalForwardingDelay = time.Second * 30
The signal can be sent to the main process (only `terragrunt`) as well as the process group (`terragrunt` and `terraform`), for example: kill -INT <pid> # sends SIGINT only to the main process kill -INT -<pid> # sends SIGINT to the process group Since we cannot know how the signal is sent, we should give `terraform` time to gracefully exit if it receives the signal directly from the shell, to avoid sending the second interrupt signal to `terraform`.
const TerraformCommandContextKey ctxKey = iota
Variables ¶
Functions ¶
func ContextWithTerraformCommandHook ¶ added in v0.56.4
func ContextWithTerraformCommandHook(ctx context.Context, fn RunShellCommandFunc) context.Context
func ExplainError ¶ added in v0.45.5
ExplainError will try to explain the error to the user, if we know how to do so.
func GetExitCode ¶ added in v0.10.3
Return the exit code of a command. If the error does not implement iErrorCode or is not an exec.ExitError or *multierror.Error type, the error is returned.
func GitLastReleaseTag ¶ added in v0.54.0
func GitLastReleaseTag(ctx context.Context, opts *options.TerragruntOptions, gitRepo *url.URL) (string, error)
GitLastReleaseTag - fetch git repository last release tag
func GitRepoTags ¶ added in v0.54.0
func GitRepoTags(ctx context.Context, opts *options.TerragruntOptions, gitRepo *url.URL) ([]string, error)
GitRepoTags - fetch git repository tags from passed url
func GitTopLevelDir ¶ added in v0.33.0
func GitTopLevelDir(ctx context.Context, terragruntOptions *options.TerragruntOptions, path string) (string, error)
GitTopLevelDir - fetch git repository path from passed directory
func PrepareConsole ¶ added in v0.23.27
func PrepareConsole(terragruntOptions *options.TerragruntOptions)
func PromptUserForInput ¶
func PromptUserForInput(prompt string, terragruntOptions *options.TerragruntOptions) (string, error)
Prompt the user for text in the CLI. Returns the text entered by the user.
func PromptUserForYesNo ¶
func PromptUserForYesNo(prompt string, terragruntOptions *options.TerragruntOptions) (bool, error)
Prompt the user for a yes/no response and return true if they entered yes.
func RegisterSignalHandler ¶ added in v0.56.4
RegisterSignalHandler registers a handler of interrupt signal from the OS. When signal is receiving, it calls the given callback func `notifyFn`.
func RunShellCommand ¶
func RunShellCommand(ctx context.Context, terragruntOptions *options.TerragruntOptions, command string, args ...string) error
Run the given shell command
func RunTerraformCommand ¶ added in v0.12.10
func RunTerraformCommand(ctx context.Context, terragruntOptions *options.TerragruntOptions, args ...string) error
Run the given Terraform command
Types ¶
type CmdOutput ¶ added in v0.17.3
func RunShellCommandWithOutput ¶ added in v0.17.0
func RunShellCommandWithOutput( ctx context.Context, terragruntOptions *options.TerragruntOptions, workingDir string, suppressStdout bool, allocatePseudoTty bool, command string, args ...string, ) (*CmdOutput, error)
Run the specified shell command with the specified arguments. Connect the command's stdin, stdout, and stderr to the currently running app. The command can be executed in a custom working directory by using the parameter `workingDir`. Terragrunt working directory will be assumed if empty string.
func RunTerraformCommandWithOutput ¶ added in v0.17.0
func RunTerraformCommandWithOutput(ctx context.Context, terragruntOptions *options.TerragruntOptions, args ...string) (*CmdOutput, error)
Run the given Terraform command, writing its stdout/stderr to the terminal AND returning stdout/stderr to this method's caller
type ProcessExecutionError ¶ added in v0.38.2
ProcessExecutionError - error returned when a command fails, contains StdOut and StdErr
func (ProcessExecutionError) Error ¶ added in v0.38.2
func (err ProcessExecutionError) Error() string
func (ProcessExecutionError) ExitStatus ¶ added in v0.38.2
func (err ProcessExecutionError) ExitStatus() (int, error)
type RunShellCommandFunc ¶ added in v0.56.4
type RunShellCommandFunc func(ctx context.Context, opts *options.TerragruntOptions, args []string) error
func TerraformCommandHookFromContext ¶ added in v0.56.4
func TerraformCommandHookFromContext(ctx context.Context) RunShellCommandFunc
type SignalsForwarder ¶ added in v0.7.3
func NewSignalsForwarder ¶ added in v0.7.3
func NewSignalsForwarder(signals []os.Signal, c *exec.Cmd, logger *logrus.Entry, cmdChannel chan error) SignalsForwarder
Forwards signals to a command, waiting for the command to finish.
func (*SignalsForwarder) Close ¶ added in v0.7.3
func (signalChannel *SignalsForwarder) Close() error