Skip to content

Commit e0d0939

Browse files
Merge remote-tracking branch 'origin/master' into gauntlt
2 parents e61cb73 + 5be9f52 commit e0d0939

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

Jenkinsfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ stage('Checkout') {
151151

152152
stage('Validate') {
153153
node {
154-
unstash 'src'
155154
wrap.call({
155+
unstash 'src'
156156
// Validate packer templates, check branch
157157
sh ("./bin/validate.sh")
158158
})
@@ -163,8 +163,8 @@ stage('Validate') {
163163
if (params.Run_Packer) {
164164
stage('Pack') {
165165
node {
166-
unstash 'src'
167166
wrap.call({
167+
unstash 'src'
168168
sh ("./bin/pack.sh")
169169
archive (includes: 'build/**')
170170
publishHTML (target: [
@@ -182,8 +182,8 @@ if (params.Run_Packer) {
182182

183183
stage('Build CodeDeploy Archive') {
184184
node {
185-
unstash 'src'
186185
wrap.call({
186+
unstash 'src'
187187
sh ("./bin/build-codedeploy.sh")
188188
})
189189
}
@@ -194,8 +194,8 @@ def terraform_prompt = 'Should we apply the Terraform plan?'
194194

195195
stage('Plan Terraform') {
196196
node {
197-
unstash 'src'
198197
wrap.call({
198+
unstash 'src'
199199
def verb = "plan"
200200
if (params.Destroy_Terraform) {
201201
verb += '-destroy';
@@ -218,8 +218,8 @@ if (params.Apply_Terraform || params.Destroy_Terraform) {
218218
}
219219
stage('Apply Terraform') {
220220
node {
221-
unstash 'plan'
222221
wrap.call({
222+
unstash 'plan'
223223
sh ("./bin/terraform.sh apply")
224224
})
225225
}
@@ -233,8 +233,8 @@ if (params.Apply_Terraform || params.Destroy_Terraform) {
233233
if (params.Rotate_Servers) {
234234
stage('Rotate Servers') {
235235
node {
236-
unstash 'src'
237236
wrap.call({
237+
unstash 'src'
238238
sh ("./bin/rotate-asg.sh infra-demo-asg")
239239
})
240240
}
@@ -244,8 +244,8 @@ if (params.Rotate_Servers) {
244244
if (params.Run_JMeter) {
245245
stage('Run JMeter') {
246246
node {
247-
unstash 'src'
248247
wrap.call({
248+
unstash 'src'
249249
sh ("""
250250
HOST=\$(./bin/terraform.sh output route53-dns)
251251
./bin/jmeter.sh -Jnum_threads=${params.JMETER_num_threads} -Jramp_time=${params.JMETER_ramp_time} -Jduration=${params.JMETER_duration} -Jhost=\$HOST

bin/clean-workspace.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export BASE_DIR
1919
# shellcheck disable=SC1090
2020
. "$DIR/common.sh"
2121

22-
cp "$BASE_DIR/env.sh.sample" "$BASE_DIR/env.sh"
2322
clean_root_owned_docker_files
24-
rm -rf "$BUILD_DIR"
23+
cp "$BASE_DIR/env.sh.sample" "$BASE_DIR/env.sh"
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)