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
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/terrafying/components/security/pagerduty_topic.rb', line 19
def create(
name,
escalation_policy_id:
)
ident = tf_safe(name)
service = resource :pagerduty_service, ident, {
name: name,
auto_resolve_timeout: 14400,
acknowledgement_timeout: 600,
escalation_policy: escalation_policy_id,
}
vendor = data :pagerduty_vendor, ident, {
name: "Amazon CloudWatch",
}
integration = resource :pagerduty_service_integration, ident, {
name: "SNS",
vendor: vendor["id"],
service: service["id"],
}
topic = resource :aws_sns_topic, ident, {}
@arn = topic["arn"]
resource :aws_sns_topic_subscription, ident, {
topic_arn: @arn,
protocol: "https",
endpoint: "https://events.pagerduty.com/integration/#{integration["integration_key"]}/enqueue",
endpoint_auto_confirms: true,
}
self
end
|