Skip to content

Commit 6167712

Browse files
Merge pull request #32 from ModusCreateOrg/make-new-relic-alerts-optional
Make New Relic alerts optional
2 parents 84d775a + f947f22 commit 6167712

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

bin/clean-workspace.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ export BASE_DIR
2121

2222
cp "$BASE_DIR/env.sh.sample" "$BASE_DIR/env.sh"
2323
clean_root_owned_docker_files
24-
rm -rf "$BUILD_DIR"
24+
rm -rf "$BUILD_DIR" "$BASE_DIR/terraform/.terraform"
2525
mkdir "$BUILD_DIR"

terraform/newrelic.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ resource "newrelic_alert_condition" "spin-appdex" {
3232

3333
condition_scope = "application"
3434

35-
count = "${length(var.newrelic_apm_entities) > 0 ? 1 : 0}"
35+
count = "${length(var.newrelic_apm_entities) > 0 ? (var.newrelic_alerts ? 1 : 0) : 0}"
3636
}
3737

3838
# Add a notification channel
@@ -45,15 +45,15 @@ resource "newrelic_alert_channel" "email" {
4545
include_json_attachment = "1"
4646
}
4747

48-
count = "${length(var.newrelic_alert_email) > 0 ? 1 : 0}"
48+
count = "${length(var.newrelic_alert_email) > 0 ? (var.newrelic_alerts ? 1 : 0) : 0}"
4949
}
5050

5151
# Link the channel to the policy
5252
resource "newrelic_alert_policy_channel" "alert_email" {
5353
policy_id = "${newrelic_alert_policy.alert.id}"
5454
channel_id = "${newrelic_alert_channel.email.id}"
5555

56-
count = "${length(var.newrelic_alert_email) > 0 ? 1 : 0}"
56+
count = "${length(var.newrelic_alert_email) > 0 ? (var.newrelic_alerts ? 1 : 0) : 0}"
5757
}
5858

5959
# Add a dashboard

terraform/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "newrelic_apm_entities" {
9696
default = []
9797
}
9898

99+
# You have to have a full-blown New Relic subscription in order to deal with Alerts
100+
variable "newrelic_alerts" {
101+
description = "Enable New Relic alerts"
102+
default = false
103+
}
104+
99105
variable "newrelic_runbook_url" {
100106
description = "New Relic runbook URL"
101107
default = "https://github.com/ModusCreateOrg/devops-infra-demo/wiki/runbook"

terraform/vpc.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module "vpc" {
2-
source = "github.com/terraform-aws-modules/terraform-aws-vpc"
2+
source = "terraform-aws-modules/vpc/aws"
3+
version = "~> v1.0"
34

45
name = "infra-demo-vpc"
56

0 commit comments

Comments
 (0)