From 3d40f3a53b032a06fbebd81dee3e207fa2c8cfd6 Mon Sep 17 00:00:00 2001 From: Kyle Kotowick Date: Mon, 28 Mar 2022 11:50:54 -0400 Subject: [PATCH] Add suppress_console variable --- main.tf | 12 ++++++++---- variables.tf | 10 ++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/main.tf b/main.tf index f88b72b..c699942 100644 --- a/main.tf +++ b/main.tf @@ -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 @@ -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" diff --git a/variables.tf b/variables.tf index f25224a..da766c8 100644 --- a/variables.tf +++ b/variables.tf @@ -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\"." +}