File tree Expand file tree Collapse file tree 2 files changed +52
-2
lines changed Expand file tree Collapse file tree 2 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ provider "aws" {
7
7
skip_credentials_validation = true
8
8
}
9
9
10
+ data "aws_caller_identity" "current" {}
11
+ data "aws_region" "current" {}
12
+
13
+
10
14
module "eventbridge" {
11
15
source = " ../../"
12
16
@@ -50,6 +54,7 @@ module "eventbridge_archive_only" {
50
54
51
55
create_bus = false
52
56
create_archives = true
57
+ kms_key_identifier = module. kms . key_id
53
58
54
59
archives = {
55
60
" launch-archive-existing-bus" = {
@@ -79,3 +84,48 @@ resource "random_pet" "this" {
79
84
resource "aws_cloudwatch_event_bus" "existing_bus" {
80
85
name = " ${ random_pet . this . id } -existing-bus"
81
86
}
87
+
88
+ module "kms" {
89
+ source = " terraform-aws-modules/kms/aws"
90
+ version = " ~> 2.0"
91
+ description = " KMS key for cross region automated backups replication"
92
+
93
+ # Aliases
94
+ aliases = [" test" ]
95
+ aliases_use_name_prefix = true
96
+ key_statements = [
97
+ {
98
+ sid = " Allow eventbridge"
99
+ principals = [
100
+ {
101
+ type = " Service"
102
+ identifiers = [" events.amazonaws.com" ]
103
+ }
104
+ ]
105
+ actions = [
106
+ " kms:DescribeKey" ,
107
+ " kms:GenerateDataKey" ,
108
+ " kms:Decrypt"
109
+ ]
110
+ resources = [" *" ]
111
+ conditions = [
112
+ {
113
+ test = " StringEquals"
114
+ variable = " kms:EncryptionContext:aws:events:event-bus:arn"
115
+ values = [
116
+ " arn:aws:events:${ data . aws_region . current . id } :${ data . aws_caller_identity . current . account_id } :event-bus/example" ,
117
+ ]
118
+ },
119
+ {
120
+ test = " StringEquals"
121
+ variable = " aws:SourceArn"
122
+ values = [
123
+ " arn:aws:events:${ data . aws_region . current . id } :${ data . aws_caller_identity . current . account_id } :event-bus/example" ,
124
+ ]
125
+ }
126
+ ]
127
+ }
128
+ ]
129
+
130
+ key_owners = [data . aws_caller_identity . current . arn ]
131
+ }
Original file line number Diff line number Diff line change @@ -284,8 +284,8 @@ resource "aws_cloudwatch_event_archive" "this" {
284
284
285
285
region = var. region
286
286
287
- name = lookup (each. value , " name" , each. key )
288
- event_source_arn = try (each. value [" event_source_arn" ], aws_cloudwatch_event_bus. this [0 ]. arn )
287
+ name = lookup (each. value , " name" , each. key )
288
+ event_source_arn = try (each. value [" event_source_arn" ], aws_cloudwatch_event_bus. this [0 ]. arn )
289
289
kms_key_identifier = var. kms_key_identifier
290
290
291
291
description = lookup (each. value , " description" , null )
You can’t perform that action at this time.
0 commit comments