File tree Expand file tree Collapse file tree 4 files changed +82
-1
lines changed
infrastructure/terraform/components/api Expand file tree Collapse file tree 4 files changed +82
-1
lines changed Original file line number Diff line number Diff line change 44
55## Requirements
66
7- No requirements.
7+ | Name | Version |
8+ | ------| ---------|
9+ | <a name =" requirement_aws " ></a > [ aws] ( #requirement\_ aws ) | 5.81.0 |
810## Inputs
911
1012| Name | Description | Type | Default | Required |
Original file line number Diff line number Diff line change 1+ terraform {
2+ required_providers {
3+ aws = {
4+ source = " hashicorp/aws"
5+ version = " 5.81.0"
6+ }
7+ }
8+ }
9+ resource "aws_dynamodb_table" "letters" {
10+ name = " ${ local . csi } -letters"
11+ billing_mode = " PAY_PER_REQUEST"
12+
13+ hash_key = " supplierId"
14+ range_key = " id"
15+
16+ global_secondary_index {
17+ name = " supplierStatus-index"
18+ hash_key = " supplierStatus"
19+ range_key = " id"
20+ projection_type = " ALL"
21+ }
22+
23+ attribute {
24+ name = " id"
25+ type = " string"
26+ }
27+
28+ attribute {
29+ name = " supplierId"
30+ type = " string"
31+ }
32+
33+ attribute {
34+ name = " supplierStatus"
35+ type = " string"
36+ }
37+
38+ tags = var. default_tags
39+ }
Original file line number Diff line number Diff line change 1+ resource "aws_dynamodb_table" "mi" {
2+ name = " ${ local . csi } -mi"
3+ billing_mode = " PAY_PER_REQUEST"
4+
5+ hash_key = " supplierId"
6+ range_key = " id"
7+
8+ attribute {
9+ name = " id"
10+ type = " string"
11+ }
12+
13+ attribute {
14+ name = " supplierId"
15+ type = " string"
16+ }
17+
18+ tags = var. default_tags
19+ }
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ module "get_letters" {
3636 log_subscription_role_arn = local. acct . log_subscription_role_arn
3737
3838 lambda_env_vars = {
39+ LETTERS_TABLE_NAME = aws_dynamodb_table.letters.name
3940 }
4041}
4142
@@ -53,4 +54,24 @@ data "aws_iam_policy_document" "get_letters_lambda" {
5354 module . kms . key_arn , # # Requires shared kms module
5455 ]
5556 }
57+
58+ statement {
59+ sid = " AllowDynamoDBAccess"
60+ effect = " Allow"
61+
62+ actions = [
63+ " dynamodb:BatchGetItem" ,
64+ " dynamodb:BatchWriteItem" ,
65+ " dynamodb:DeleteItem" ,
66+ " dynamodb:GetItem" ,
67+ " dynamodb:PutItem" ,
68+ " dynamodb:Query" ,
69+ " dynamodb:Scan" ,
70+ " dynamodb:UpdateItem" ,
71+ ]
72+
73+ resources = [
74+ aws_dynamodb_table . letters . arn ,
75+ ]
76+ }
5677}
You can’t perform that action at this time.
0 commit comments