Skip to content

Commit 945a1f7

Browse files
[PRM-134-v2] add permission to query indexes that aren't global secondary
1 parent c1a9a33 commit 945a1f7

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

infrastructure/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@
233233
| [aws_default_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) | resource |
234234
| [aws_default_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) | resource |
235235
| [aws_iam_policy.alerting_lambda_alarms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
236+
| [aws_iam_policy.alerting_lambda_dynamo_index](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
236237
| [aws_iam_policy.cloudwatch_log_query_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
237238
| [aws_iam_policy.cloudwatch_rum_cognito_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
238239
| [aws_iam_policy.copy_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
@@ -307,7 +308,6 @@
307308
| [aws_lambda_permission.bulk_upload_report_schedule_permission](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
308309
| [aws_lambda_permission.data_collection_schedule_permission](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
309310
| [aws_lambda_permission.im_alerting_invoke_with_search_patient_sns](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
310-
| [aws_lambda_permission.im_alerting_lambda_invoke_with_sns](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
311311
| [aws_lambda_permission.nhs_oauth_token_generator_schedule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
312312
| [aws_lambda_permission.statistical_report_schedule_permission](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
313313
| [aws_rum_app_monitor.ndr](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rum_app_monitor) | resource |
@@ -326,7 +326,6 @@
326326
| [aws_scheduler_schedule.data_collection_ecs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/scheduler_schedule) | resource |
327327
| [aws_sns_topic.alarm_notifications_topic](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic) | resource |
328328
| [aws_sns_topic_subscription.alarm_notifications_sns_topic_subscription](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |
329-
| [aws_sns_topic_subscription.im_alerting](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |
330329
| [aws_sns_topic_subscription.im_alerting_search_patient](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |
331330
| [aws_sqs_queue_policy.mns_sqs_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue_policy) | resource |
332331
| [aws_wafv2_web_acl_association.web_acl_association](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_web_acl_association) | resource |

infrastructure/dynamo_db.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ module "alarm_state_history_table" {
437437

438438
# global_secondary_indexes = [
439439
# {
440-
# name = "AlarmNameIndex"
441-
# hash_key = "AlarmName"
440+
# name = "AlarmNameMetricIndex"
441+
# hash_key = "AlarmNameMetric"
442442
# projection_type = "ALL"
443443
# }]
444444

infrastructure/lambda-im-alerting.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,20 @@ resource "aws_iam_policy" "alerting_lambda_alarms" {
6060
},
6161
]
6262
})
63+
}
64+
65+
resource "aws_iam_policy" "alerting_lambda_dynamo_index" {
66+
name = "${terraform.workspace}_alerting_lambda_dynamo_index_policy"
67+
description = "Policy to allow query by index with creating secondary global index"
68+
policy = jsonencode({
69+
Version = "2012-10-17"
70+
Statement = [
71+
{
72+
Action = [
73+
"dynamodb:Query"
74+
]
75+
Effect = "Allow"
76+
Resource = "${module.alarm_state_history_table.dynamodb_table_arn}/index/*"
77+
}]
78+
})
6379
}

0 commit comments

Comments
 (0)