Skip to content

Commit 97e5761

Browse files
committed
Add Linkry replication regions
1 parent 92b85c7 commit 97e5761

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

terraform/envs/prod/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ locals {
3737
main = module.sqs_queues.main_queue_arn
3838
sqs = module.sqs_queues.sales_email_queue_arn
3939
}
40+
LinkryReplicationRegions = toset(["us-east-1", "us-west-2", "eu-central-1", "ap-south-1"])
4041
}
4142

4243
module "sqs_queues" {
@@ -46,8 +47,9 @@ module "sqs_queues" {
4647
}
4748

4849
module "dynamo" {
49-
source = "../../modules/dynamo"
50-
ProjectId = var.ProjectId
50+
source = "../../modules/dynamo"
51+
ProjectId = var.ProjectId
52+
LinkryReplicationRegions = local.LinkryReplicationRegions
5153
}
5254

5355
module "origin_verify" {

terraform/envs/qa/main.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ provider "aws" {
3131
data "aws_caller_identity" "current" {}
3232
data "aws_region" "current" {}
3333

34+
locals {
35+
LinkryReplicationRegions = toset(["us-east-1", "us-west-2", "eu-central-1", "ap-south-1"])
36+
}
37+
3438

3539
module "sqs_queues" {
3640
depends_on = [module.lambdas]
@@ -47,8 +51,9 @@ locals {
4751
}
4852

4953
module "dynamo" {
50-
source = "../../modules/dynamo"
51-
ProjectId = var.ProjectId
54+
source = "../../modules/dynamo"
55+
ProjectId = var.ProjectId
56+
LinkryReplicationRegions = local.LinkryReplicationRegions
5257
}
5358

5459
module "origin_verify" {

terraform/modules/dynamo/main.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,13 @@ resource "aws_dynamodb_table" "linkry_records" {
290290
name = "access"
291291
type = "S"
292292
}
293-
293+
dynamic "replica" {
294+
for_each = var.LinkryReplicationRegions
295+
content {
296+
region_name = replica.value
297+
deletion_protection_enabled = true
298+
}
299+
}
294300
global_secondary_index {
295301
name = "AccessIndex"
296302
hash_key = "access"

terraform/modules/dynamo/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ variable "ProjectId" {
22
type = string
33
description = "Prefix before each resource"
44
}
5+
6+
variable "LinkryReplicationRegions" {
7+
type = set(string)
8+
description = "A list of regions where the Linkry data should be replicated to (in addition to the primary region)"
9+
}

0 commit comments

Comments
 (0)