Skip to content

Commit 348d6be

Browse files
authored
Merge pull request #17 from Pancham97/feat-add-security-group-to-dax
feat: add security group IDs to DAX module
2 parents 75a0b90 + 9a482f5 commit 348d6be

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ override.tf.json
2828
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
2929
# example: *tfplan*
3030
.DS_Store
31+
.dccache

dax/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ No requirements.
1818
| query\_cache\_ttl\_\_milli\_second | Time after which item query will invalidate. Default 5 minutes | `number` | `300000` | no |
1919
| region | n/a | `string` | n/a | yes |
2020
| replication\_factor | (Required) The number of nodes in the DAX cluster | `number` | `3` | no |
21+
| security_group_ids | The list of Security Group IDs to be associated with the DAX cluster | `list(string)` | n/a | yes |
2122
| tables | List of tables for using dax | `list(string)` | n/a | yes |
2223
| tags | A map of tags to assign to the resource | `any` | n/a | yes |
2324
| vpc\_id | n/a | `string` | n/a | yes |
@@ -53,6 +54,10 @@ module "my_dax" {
5354
replication_factor = 3
5455
query_cache_ttl__milli_second = 30 * 1000
5556
item_cache_ttl_milli_second = 30 * 60 * 1000
57+
security_group_ids = [
58+
"sg-123456789",
59+
"sg-987654321"
60+
]
5661
tables = [
5762
"table1",
5863
"table2"

dax/main.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ data "aws_iam_policy_document" "document" {
4444
statement {
4545
effect = "Allow"
4646
actions = [
47+
"dynamodb:BatchGetItem",
48+
"dynamodb:BatchWriteItem",
49+
"dynamodb:ConditionCheckItem",
50+
"dynamodb:DeleteItem",
4751
"dynamodb:DescribeTable",
48-
"dynamodb:PutItem",
4952
"dynamodb:GetItem",
50-
"dynamodb:UpdateItem",
51-
"dynamodb:DeleteItem",
53+
"dynamodb:PutItem",
5254
"dynamodb:Query",
5355
"dynamodb:Scan",
54-
"dynamodb:BatchGetItem",
55-
"dynamodb:BatchWriteItem",
56-
"dynamodb:ConditionCheckItem"
56+
"dynamodb:UpdateItem"
5757
]
5858
resources = flatten(local.table_arns)
5959
}
@@ -95,6 +95,7 @@ resource "aws_dax_cluster" "cluster" {
9595
node_type = var.node_type
9696
replication_factor = var.replication_factor
9797
parameter_group_name = aws_dax_parameter_group.group.name
98+
security_group_ids = var.security_group_ids
9899
subnet_group_name = aws_dax_subnet_group.subnet_group.id
99100
server_side_encryption {
100101
enabled = true

dax/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ variable "query_cache_ttl__milli_second" {
4040
default = 300000
4141
description = "Time after which query cache will invalidate. Default 5 minutes"
4242
}
43+
44+
variable "security_group_ids" {
45+
type = list(string)
46+
description = "(Required) One or more VPC security groups associated with the cluster"
47+
}

0 commit comments

Comments
 (0)