diff --git a/bin/clean-workspace.sh b/bin/clean-workspace.sh index a227196..8e9eb0d 100755 --- a/bin/clean-workspace.sh +++ b/bin/clean-workspace.sh @@ -21,5 +21,5 @@ export BASE_DIR cp "$BASE_DIR/env.sh.sample" "$BASE_DIR/env.sh" clean_root_owned_docker_files -rm -rf "$BUILD_DIR" +rm -rf "$BUILD_DIR" "$BASE_DIR/terraform/.terraform" mkdir "$BUILD_DIR" diff --git a/terraform/newrelic.tf b/terraform/newrelic.tf index 518e193..228a77f 100644 --- a/terraform/newrelic.tf +++ b/terraform/newrelic.tf @@ -32,7 +32,7 @@ resource "newrelic_alert_condition" "spin-appdex" { condition_scope = "application" - count = "${length(var.newrelic_apm_entities) > 0 ? 1 : 0}" + count = "${length(var.newrelic_apm_entities) > 0 ? (var.newrelic_alerts ? 1 : 0) : 0}" } # Add a notification channel @@ -45,7 +45,7 @@ resource "newrelic_alert_channel" "email" { include_json_attachment = "1" } - count = "${length(var.newrelic_alert_email) > 0 ? 1 : 0}" + count = "${length(var.newrelic_alert_email) > 0 ? (var.newrelic_alerts ? 1 : 0) : 0}" } # Link the channel to the policy @@ -53,7 +53,7 @@ resource "newrelic_alert_policy_channel" "alert_email" { policy_id = "${newrelic_alert_policy.alert.id}" channel_id = "${newrelic_alert_channel.email.id}" - count = "${length(var.newrelic_alert_email) > 0 ? 1 : 0}" + count = "${length(var.newrelic_alert_email) > 0 ? (var.newrelic_alerts ? 1 : 0) : 0}" } # Add a dashboard diff --git a/terraform/variables.tf b/terraform/variables.tf index ba95f70..0ac2282 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -96,6 +96,12 @@ variable "newrelic_apm_entities" { default = [] } +# You have to have a full-blown New Relic subscription in order to deal with Alerts +variable "newrelic_alerts" { + description = "Enable New Relic alerts" + default = false +} + variable "newrelic_runbook_url" { description = "New Relic runbook URL" default = "https://github.com/ModusCreateOrg/devops-infra-demo/wiki/runbook" diff --git a/terraform/vpc.tf b/terraform/vpc.tf index 1436b27..63063b7 100644 --- a/terraform/vpc.tf +++ b/terraform/vpc.tf @@ -1,5 +1,6 @@ module "vpc" { - source = "github.com/terraform-aws-modules/terraform-aws-vpc" + source = "terraform-aws-modules/vpc/aws" + version = "~> v1.0" name = "infra-demo-vpc"