Skip to content

Commit cbeddfd

Browse files
authored
Merge pull request #108 from NHSDigital/feature/CCM-11007_log_sub
CCM-11007: Fixing IAM permissions for Splunk forwarding
2 parents af4e448 + d342281 commit cbeddfd

File tree

7 files changed

+33
-92
lines changed

7 files changed

+33
-92
lines changed

infrastructure/terraform/components/obs/iam_role_firehose_to_s3.tf

Lines changed: 0 additions & 66 deletions
This file was deleted.

infrastructure/terraform/components/obs/module_kinesis_firehose_to_splunk_logs.tf

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ module "kinesis_firehose_to_splunk_logs" {
88
group = var.group
99
component = var.component
1010

11-
default_tags = var.default_tags
12-
log_retention_in_days = var.log_retention_in_days
13-
type = "logs"
14-
kms_splunk_key_arn = module.kms_splunk.key_arn
15-
splunk_firehose_bucket_arn = module.s3bucket_splunk_firehose.arn
16-
firehose_to_s3_role_arn = aws_iam_role.firehose_to_s3.arn
11+
default_tags = var.default_tags
12+
log_retention_in_days = var.log_retention_in_days
13+
type = "logs"
14+
kms_splunk_key_arn = module.kms_splunk.key_arn
15+
splunk_firehose_bucket_arn = module.s3bucket_splunk_firehose.arn
1716
formatter_lambda_function_arn = module.splunk_logs_formatter_lambda.function_arn
1817
}

infrastructure/terraform/components/obs/module_kinesis_firehose_to_splunk_metrics.tf

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ module "kinesis_firehose_to_splunk_metrics" {
88
group = var.group
99
component = var.component
1010

11-
default_tags = var.default_tags
12-
log_retention_in_days = var.log_retention_in_days
13-
type = "metrics"
14-
kms_splunk_key_arn = module.kms_splunk.key_arn
15-
splunk_firehose_bucket_arn = module.s3bucket_splunk_firehose.arn
16-
firehose_to_s3_role_arn = aws_iam_role.firehose_to_s3.arn
11+
default_tags = var.default_tags
12+
log_retention_in_days = var.log_retention_in_days
13+
type = "metrics"
14+
kms_splunk_key_arn = module.kms_splunk.key_arn
15+
splunk_firehose_bucket_arn = module.s3bucket_splunk_firehose.arn
1716
formatter_lambda_function_arn = module.splunk_metrics_formatter_lambda.function_arn
1817
}

infrastructure/terraform/components/obs/module_kinesis_firehose_to_splunk_metrics_us.tf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ module "kinesis_firehose_to_splunk_metrics_us" {
1212
group = var.group
1313
component = var.component
1414

15-
default_tags = var.default_tags
16-
log_retention_in_days = var.log_retention_in_days
17-
type = "metrics"
18-
region_prefix = "us"
19-
kms_splunk_key_arn = module.kms_splunk.replica_key_arn
20-
splunk_firehose_bucket_arn = module.s3bucket_splunk_firehose_us.arn
21-
firehose_to_s3_role_arn = aws_iam_role.firehose_to_s3.arn
15+
default_tags = var.default_tags
16+
log_retention_in_days = var.log_retention_in_days
17+
type = "metrics"
18+
region_prefix = "us"
19+
kms_splunk_key_arn = module.kms_splunk.replica_key_arn
20+
splunk_firehose_bucket_arn = module.s3bucket_splunk_firehose_us.arn
2221
formatter_lambda_function_arn = module.splunk_metrics_formatter_lambda_us.function_arn
2322
}

infrastructure/terraform/modules/kinesis-firehose-to-splunk/iam_role_kinesis_firehose.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ data "aws_iam_policy_document" "kinesis_firehose_policy_document" {
5050
]
5151
}
5252

53+
statement {
54+
actions = [
55+
"kms:Decrypt",
56+
"kms:GenerateDataKey",
57+
"kms:DescribeKey",
58+
"kms:Encrypt",
59+
"kms:ReEncrypt*",
60+
]
61+
62+
resources = [
63+
var.kms_splunk_key_arn
64+
]
65+
66+
effect = "Allow"
67+
}
68+
5369
statement {
5470
actions = [
5571
"logs:PutLogEvents",

infrastructure/terraform/modules/kinesis-firehose-to-splunk/kinesis_firehose_delivery_stream_splunk.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ resource "aws_kinesis_firehose_delivery_stream" "splunk_firehose" {
3737
}
3838

3939
s3_configuration {
40-
role_arn = var.firehose_to_s3_role_arn
40+
role_arn = aws_iam_role.kinesis_firehose.arn
4141
bucket_arn = var.splunk_firehose_bucket_arn
4242
buffering_size = var.s3_kinesis_firehose_buffer
4343
buffering_interval = var.s3_kinesis_firehose_buffer_interval

infrastructure/terraform/modules/kinesis-firehose-to-splunk/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ variable "splunk_firehose_bucket_arn" {
8181
default = null
8282
}
8383

84-
variable "firehose_to_s3_role_arn" {
85-
type = string
86-
description = "The ARN of the IAM role to use for the Splunk Firehose to S3"
87-
default = null
88-
}
89-
9084
variable "formatter_lambda_buffer" {
9185
description = "Formatter lambda buffer size"
9286
default = 1 # Megabytes (Maximum 3)

0 commit comments

Comments
 (0)