-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmodules_eventpub.tf
More file actions
61 lines (47 loc) · 1.49 KB
/
modules_eventpub.tf
File metadata and controls
61 lines (47 loc) · 1.49 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module "eventpub" {
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.30/terraform-eventpub.zip"
name = "eventpub"
aws_account_id = var.aws_account_id
component = var.component
environment = var.environment
project = var.project
region = var.region
group = var.group
default_tags = local.default_tags
kms_key_arn = module.kms.key_arn
log_retention_in_days = var.log_retention_in_days
log_level = var.log_level
force_destroy = var.force_destroy
event_cache_buffer_interval = 500
enable_sns_delivery_logging = true
sns_success_logging_sample_percent = 0
event_cache_expiry_days = 30
enable_event_cache = true
data_plane_bus_arn = var.eventpub_data_plane_bus_arn
control_plane_bus_arn = var.eventpub_control_plane_bus_arn
}
resource "aws_sns_topic_policy" "eventbridge_publish" {
arn = module.eventpub.sns_topic.arn
policy = data.aws_iam_policy_document.sns_publish.json
}
data "aws_iam_policy_document" "sns_publish" {
statement {
sid = "AllowEventBridgePublish"
effect = "Allow"
principals {
type = "Service"
identifiers = ["events.amazonaws.com"]
}
actions = [
"sns:Publish"
]
resources = [
module.eventpub.sns_topic.arn
]
condition {
test = "ArnEquals"
variable = "aws:SourceArn"
values = [aws_cloudwatch_event_rule.letter_prepared.arn]
}
}
}