Skip to content

Commit 9331df2

Browse files
committed
Allow for transfering data from legacay dynamo tables
1 parent 2fe2850 commit 9331df2

File tree

6 files changed

+27
-6
lines changed

6 files changed

+27
-6
lines changed

infra/mdf/dev/main.tf

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ module "dynamodb" {
4545
env = var.env
4646
namespace = var.namespace
4747
env_vars = var.env_vars
48+
resource_tags = var.resource_tags
49+
dynamodb_write_capacity = 20
4850
}
4951

5052
module "permissions" {
@@ -53,6 +55,7 @@ module "permissions" {
5355
namespace = var.namespace
5456
mdf_secrets_arn = var.mdf_secrets_arn
5557
dynamo_db_arn = module.dynamodb.dynamodb_arn
58+
legacy_table_arn = "arn:aws:dynamodb:us-east-1:557062710055:table/dev-status-0.4"
5659
}
5760

5861
module "api_gateway" {

infra/mdf/modules/dynamo/main.tf

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
12
resource "aws_dynamodb_table" "dynamodb-table" {
23
name = "${var.namespace}-${var.env}"
34
billing_mode = "PROVISIONED"
45
read_capacity = 5
5-
write_capacity = 5
6+
write_capacity = var.dynamodb_write_capacity
67
hash_key = "source_id"
78
range_key = "version"
89
attribute {
@@ -21,8 +22,5 @@ resource "aws_dynamodb_table" "dynamodb-table" {
2122
enabled = false
2223
}
2324

24-
tags = {
25-
Name = var.namespace
26-
Environment = var.env
27-
}
25+
tags = var.resource_tags
2826
}

infra/mdf/modules/dynamo/variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,14 @@ variable "namespace" {
1111
variable "env_vars" {
1212
description = "Set of environment variables for the functions."
1313
type = map(string)
14+
}
15+
16+
variable "resource_tags" {
17+
description = "Tags to apply to all resources."
18+
type = map(string)
19+
}
20+
21+
variable "dynamodb_write_capacity" {
22+
type = number
23+
description = "The write capacity for the DynamoDB table."
1424
}

infra/mdf/modules/permissions/main.tf

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ resource "aws_iam_policy" "lambda_dynamodb_policy" {
7575
"dynamodb:Scan",
7676
],
7777
Effect = "Allow",
78-
Resource = [ var.dynamo_db_arn ]
78+
Resource = [
79+
var.dynamo_db_arn,
80+
var.legacy_table_arn
81+
]
7982
},
8083
],
8184
})

infra/mdf/modules/permissions/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ variable "mdf_secrets_arn" {
1616
variable "dynamo_db_arn" {
1717
type = string
1818
description = "ARN of the DynamoDB table"
19+
}
20+
21+
variable "legacy_table_arn" {
22+
type = string
23+
description = "ARN of the legacy DynamoDB table"
1924
}

infra/mdf/prod/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module "dynamodb" {
4444
env = var.env
4545
namespace = var.namespace
4646
env_vars = var.env_vars
47+
resource_tags = var.resource_tags
4748
}
4849

4950
module "permissions" {
@@ -52,6 +53,7 @@ module "permissions" {
5253
namespace = var.namespace
5354
mdf_secrets_arn = var.mdf_secrets_arn
5455
dynamo_db_arn = module.dynamodb.dynamodb_arn
56+
legacy_table_arn = "arn:aws:dynamodb:us-east-1:557062710055:table/prod-status-alpha-1"
5557
}
5658

5759
module "api_gateway" {

0 commit comments

Comments
 (0)