Skip to content

Commit

Permalink
Adding dynamo stream for plugin-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
manasaV3 committed Jun 7, 2023
1 parent d5476f3 commit 09f7146
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .happy/terraform/modules/dynamo/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ module dynamodb {
autoscaling_enabled = var.autoscaling_enabled
create_table = var.create_table

ttl_enabled = var.ttl_enabled
ttl_enabled = var.ttl_enabled
ttl_attribute_name = var.ttl_attribute_name

stream_enabled = var.stream_enabled
stream_view_type = var.stream_view_type

tags = var.tags
}
10 changes: 10 additions & 0 deletions .happy/terraform/modules/dynamo/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@ output table_arn {
description = "ARN of the DynamoDB table"
value = module.dynamodb.dynamodb_table_arn
}

output stream_arn {
description = "ARN of the DynamoDB table Stream"
value = module.dynamodb.dynamodb_table_stream_arn
}

output stream_label {
description = "Label of the DynamoDB table Stream"
value = module.dynamodb.dynamodb_table_stream_label
}
12 changes: 12 additions & 0 deletions .happy/terraform/modules/dynamo/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ variable range_key {
default = null
}

variable stream_enabled {
type = bool
description = "Please provide if stream is enabled"
default = false
}

variable stream_view_type {
type = string
description = "Please provide the stream_view_type for table if stream enabled"
default = null
}

variable table_class {
type = string
description = "Please provide table_class"
Expand Down
10 changes: 6 additions & 4 deletions .happy/terraform/modules/ecs-stack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ module plugin_metadata_dynamodb_table {
autoscaling_enabled = var.env == "dev" ? false : true
create_table = true
tags = var.tags
stream_enabled = true
stream_view_type = "KEYS_ONLY"
}

module plugin_blocked_dynamodb_table {
Expand Down Expand Up @@ -354,7 +356,7 @@ resource aws_ssm_parameter data_workflow_config {
tags = var.tags
lifecycle {
ignore_changes = [
"value",
value,
]
}
}
Expand All @@ -373,9 +375,9 @@ resource aws_sqs_queue_policy data_workflows_queue_policy {
policy = data.aws_iam_policy_document.data_workflows_sqs_policy.json
}

resource "aws_lambda_event_source_mapping" "data_workflow_sqs_event_source_mapping" {
resource aws_lambda_event_source_mapping data_workflow_sqs_event_source_mapping {
event_source_arn = aws_sqs_queue.data_workflows_queue.arn
function_name = module.data_workflows_lambda.function_arn
function_name = module.data_workflows_lambda.function_name
batch_size = 1
}

Expand Down Expand Up @@ -582,7 +584,7 @@ data aws_iam_policy_document plugins_policy {
"s3:ListBucket",
]

resources = ["${local.data_bucket_arn}"]
resources = [local.data_bucket_arn]
}

statement {
Expand Down

0 comments on commit 09f7146

Please sign in to comment.