Skip to content

Commit

Permalink
Add suppress_console variable
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick committed Mar 28, 2022
1 parent 2fcdb81 commit 3d40f3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
12 changes: 8 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
resource "aws_lambda_invocation" "shell" {
function_name = var.lambda_shell_module.invicton_labs_lambda_shell_arn
triggers = var.triggers
locals {
input = jsonencode({
interpreter = var.interpreter
interpreter = var.interpreter
// Remove carriage returns from commands, since they'll be running in a Linux environment
command = replace(replace(var.command, "\r", ""), "\r\n", "\n")
fail_on_nonzero_exit_code = var.fail_on_nonzero_exit_code
Expand All @@ -13,6 +11,12 @@ resource "aws_lambda_invocation" "shell" {
})
}

resource "aws_lambda_invocation" "shell" {
function_name = var.lambda_shell_module.invicton_labs_lambda_shell_arn
triggers = var.triggers
input = var.suppress_console ? sensitive(local.input) : local.input
}

module "state_keeper" {
source = "Invicton-Labs/state-keeper/null"
version = "~> 0.1.2"
Expand Down
10 changes: 8 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ variable "fail_on_timeout" {
}

variable "timeout" {
type = number
default = null
type = number
default = null
description = "The maximum number of seconds to allow the shell command to execute for. If it exceeds this timeout, it will be killed and will fail. Leave as the default (`null`) for no timeout."
}

variable "suppress_console" {
type = bool
default = false
description = "Whether to suppress the Terraform console output (including plan content and shell execution status messages) for this module. If enabled, much of the content will be hidden by marking it as \"sensitive\"."
}

0 comments on commit 3d40f3a

Please # to comment.