diff --git a/Jenkinsfile b/Jenkinsfile index 5e981fc..ffa130e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,7 +44,7 @@ def wrap = { fn-> } } -final Long XOR_CONST = 3735928559 // 0xdeadbeef +final Long XOR_CONST = 4919 // 0x1337 see https://en.wikipedia.org/wiki/Leet (captcha_problem, captcha_hash) = get_captcha(XOR_CONST) /** Gather properties from user parameters */ diff --git a/bin/terraform.sh b/bin/terraform.sh index fcd9af9..4ab99d5 100755 --- a/bin/terraform.sh +++ b/bin/terraform.sh @@ -78,6 +78,12 @@ EOF # http://redsymbol.net/articles/bash-exit-traps/ trap clean_root_owned_docker_files EXIT +function import() { + local -i retcode + #shellcheck disable=SC2086 + $DOCKER_TERRAFORM import "$@" +} + function show() { local -i retcode #shellcheck disable=SC2086 @@ -173,8 +179,11 @@ show) output) Message="Executing terraform output." ;; +import) + Message="Executing terraform import." + ;; *) - echo 'Unrecognized verb "'"$verb"'" specified. Use plan, plan-destroy, apply, or show' 1>&2 + echo 'Unrecognized verb "'"$verb"'" specified. Use apply, plan, plan-destroy, import, output or show' 1>&2 exit 1 ;; esac diff --git a/terraform/newrelic.tf b/terraform/newrelic.tf index 228a77f..78ae26e 100644 --- a/terraform/newrelic.tf +++ b/terraform/newrelic.tf @@ -9,7 +9,8 @@ provider "newrelic" { # Create an alert policy resource "newrelic_alert_policy" "alert" { - name = "Alert" + name = "Alert" + count = "${length(var.newrelic_apm_entities) > 0 ? (var.newrelic_alerts ? 1 : 0) : 0}" } # Add a condition