-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudformation.tf
44 lines (43 loc) · 1.05 KB
/
cloudformation.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
resource "aws_cloudformation_stack" "trigger_codebuild_stack" {
count = var.subscribe_all && var.daily_event_rule ? 1 : 0
name = "trigger-codebuild-stack"
parameters = {
BigPandaLambdaFunctionArn = aws_lambda_function.bigpanda_lambda[0].arn
SubscribeAll = var.subscribe_all
}
template_body = <<STACK
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters" : {
"SubscribeAll" : {
"Type" : "String",
"Description" : "Setting this to 'true' will automatically add the BigPanda Topic to all existing CloudWatch Alarms"
},
"BigPandaLambdaFunctionArn" : {
"Type" : "String"
}
},
"Conditions": {
"SubscribeToAlarms": {
"Fn::Equals": [
{
"Ref": "SubscribeAll"
},
"true"
]
}
},
"Resources" : {
"BigPandaInvokeLambda": {
"Type" : "AWS::CloudFormation::CustomResource",
"Properties" : {
"ServiceToken" : {
"Ref" : "BigPandaLambdaFunctionArn"
}
},
"Condition": "SubscribeToAlarms"
}
}
}
STACK
}