generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2405ebd
commit 15e23b7
Showing
7 changed files
with
286 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
terraform/environments/electronic-monitoring-data/dms_rep_task_table_mappings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"rules": [ | ||
{ | ||
"rule-type": "selection", | ||
"rule-id": "054476697", | ||
"rule-name": "054476697", | ||
"object-locator": { | ||
"schema-name": "dbo", | ||
"table-name": "%" | ||
}, | ||
"rule-action": "include", | ||
"filters": [], | ||
"parallel-load": null, | ||
"isAutoSegmentationChecked": false | ||
} | ||
] | ||
} |
52 changes: 52 additions & 0 deletions
52
terraform/environments/electronic-monitoring-data/dms_replication_instance.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Create a new replication subnet group | ||
resource "aws_dms_replication_subnet_group" "dms_replication_subnet_group" { | ||
replication_subnet_group_description = "RDS subnet group" | ||
replication_subnet_group_id = "rds-replication-subnet-group-tf" | ||
|
||
subnet_ids = tolist(aws_db_subnet_group.db.subnet_ids) | ||
|
||
tags = merge( | ||
local.tags, | ||
{ | ||
Resource_Type = "DMS Replication Subnet Group", | ||
} | ||
) | ||
|
||
# explicit depends_on is needed since this resource doesn't reference the role or policy attachment | ||
depends_on = [aws_iam_role_policy_attachment.dms-vpc-role-AmazonDMSVPCManagementRole] | ||
} | ||
|
||
# ========================================================================== | ||
|
||
# Create a new replication instance | ||
resource "aws_dms_replication_instance" "t3micro_dms_replication_instance" { | ||
allocated_storage = 20 | ||
apply_immediately = true | ||
auto_minor_version_upgrade = true | ||
availability_zone = "eu-west-2b" | ||
# engine_version = "3.5.1" | ||
# kms_key_arn = "arn:aws:kms:eu-west-2:800964199911:key/b7f54acb-16a3-4958-9340-3bdf5f5842d8" | ||
multi_az = false | ||
# preferred_maintenance_window = "sun:10:30-sun:14:30" | ||
publicly_accessible = false | ||
replication_instance_class = "dms.t3.micro" | ||
replication_instance_id = "t3micro-dms-replication-instance-tf" | ||
replication_subnet_group_id = aws_dms_replication_subnet_group.dms_replication_subnet_group.id | ||
|
||
tags = merge( | ||
local.tags, | ||
{ | ||
Resource_Type = "DMS Replication Instance", | ||
} | ||
) | ||
|
||
vpc_security_group_ids = [ | ||
aws_security_group.dms_ri_security_group.id, | ||
] | ||
|
||
depends_on = [ | ||
aws_iam_role_policy_attachment.dms-endpoint-role, | ||
aws_iam_role_policy_attachment.dms-cloudwatch-logs-role-AmazonDMSCloudWatchLogsRole, | ||
aws_iam_role_policy_attachment.dms-vpc-role-AmazonDMSVPCManagementRole | ||
] | ||
} |
174 changes: 174 additions & 0 deletions
174
terraform/environments/electronic-monitoring-data/dms_replication_task_settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
{ | ||
"Logging": { | ||
"EnableLogging": false, | ||
"EnableLogContext": false, | ||
"LogComponents": [ | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "TRANSFORMATION" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "SOURCE_UNLOAD" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "IO" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "TARGET_LOAD" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "PERFORMANCE" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "SOURCE_CAPTURE" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "SORTER" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "REST_SERVER" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "VALIDATOR_EXT" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "TARGET_APPLY" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "TASK_MANAGER" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "TABLES_MANAGER" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "METADATA_MANAGER" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "FILE_FACTORY" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "COMMON" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "ADDONS" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "DATA_STRUCTURE" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "COMMUNICATION" | ||
}, | ||
{ | ||
"Severity": "LOGGER_SEVERITY_DEFAULT", | ||
"Id": "FILE_TRANSFER" | ||
} | ||
], | ||
"CloudWatchLogGroup": null, | ||
"CloudWatchLogStream": null | ||
}, | ||
"StreamBufferSettings": { | ||
"StreamBufferCount": 3, | ||
"CtrlStreamBufferSizeInMB": 5, | ||
"StreamBufferSizeInMB": 8 | ||
}, | ||
"ErrorBehavior": { | ||
"FailOnNoTablesCaptured": true, | ||
"ApplyErrorUpdatePolicy": "LOG_ERROR", | ||
"FailOnTransactionConsistencyBreached": false, | ||
"RecoverableErrorThrottlingMax": 1800, | ||
"DataErrorEscalationPolicy": "SUSPEND_TABLE", | ||
"ApplyErrorEscalationCount": 0, | ||
"RecoverableErrorStopRetryAfterThrottlingMax": true, | ||
"RecoverableErrorThrottling": true, | ||
"ApplyErrorFailOnTruncationDdl": false, | ||
"DataTruncationErrorPolicy": "LOG_ERROR", | ||
"ApplyErrorInsertPolicy": "LOG_ERROR", | ||
"EventErrorPolicy": "IGNORE", | ||
"ApplyErrorEscalationPolicy": "LOG_ERROR", | ||
"RecoverableErrorCount": -1, | ||
"DataErrorEscalationCount": 0, | ||
"TableErrorEscalationPolicy": "STOP_TASK", | ||
"RecoverableErrorInterval": 5, | ||
"ApplyErrorDeletePolicy": "IGNORE_RECORD", | ||
"TableErrorEscalationCount": 0, | ||
"FullLoadIgnoreConflicts": true, | ||
"DataErrorPolicy": "LOG_ERROR", | ||
"TableErrorPolicy": "SUSPEND_TABLE" | ||
}, | ||
"TTSettings": null, | ||
"FullLoadSettings": { | ||
"CommitRate": 10000, | ||
"StopTaskCachedChangesApplied": false, | ||
"StopTaskCachedChangesNotApplied": false, | ||
"MaxFullLoadSubTasks": 8, | ||
"TransactionConsistencyTimeout": 600, | ||
"CreatePkAfterFullLoad": false, | ||
"TargetTablePrepMode": "DO_NOTHING" | ||
}, | ||
"TargetMetadata": { | ||
"ParallelApplyBufferSize": 0, | ||
"ParallelApplyQueuesPerThread": 0, | ||
"ParallelApplyThreads": 0, | ||
"TargetSchema": "", | ||
"InlineLobMaxSize": 0, | ||
"ParallelLoadQueuesPerThread": 0, | ||
"SupportLobs": true, | ||
"LobChunkSize": 0, | ||
"TaskRecoveryTableEnabled": false, | ||
"ParallelLoadThreads": 0, | ||
"LobMaxSize": 32, | ||
"BatchApplyEnabled": false, | ||
"FullLobMode": false, | ||
"LimitedSizeLobMode": true, | ||
"LoadMaxFileSize": 0, | ||
"ParallelLoadBufferSize": 0 | ||
}, | ||
"BeforeImageSettings": null, | ||
"ControlTablesSettings": { | ||
"historyTimeslotInMinutes": 5, | ||
"HistoryTimeslotInMinutes": 5, | ||
"StatusTableEnabled": false, | ||
"SuspendedTablesTableEnabled": false, | ||
"HistoryTableEnabled": false, | ||
"ControlSchema": "", | ||
"FullLoadExceptionTableEnabled": false | ||
}, | ||
"LoopbackPreventionSettings": null, | ||
"CharacterSetSettings": null, | ||
"FailTaskWhenCleanTaskResourceFailed": false, | ||
"ChangeProcessingTuning": { | ||
"StatementCacheSize": 50, | ||
"CommitTimeout": 1, | ||
"BatchApplyPreserveTransaction": true, | ||
"BatchApplyTimeoutMin": 1, | ||
"BatchSplitSize": 0, | ||
"BatchApplyTimeoutMax": 30, | ||
"MinTransactionSize": 1000, | ||
"MemoryKeepTime": 60, | ||
"BatchApplyMemoryLimit": 500, | ||
"MemoryLimitTotal": 1024 | ||
}, | ||
"ChangeProcessingDdlHandlingPolicy": { | ||
"HandleSourceTableDropped": true, | ||
"HandleSourceTableTruncated": true, | ||
"HandleSourceTableAltered": true | ||
}, | ||
"PostProcessingRules": null | ||
} |
18 changes: 18 additions & 0 deletions
18
terraform/environments/electronic-monitoring-data/modules/dms/dms_db_migration_task.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Create a new replication task | ||
resource "aws_dms_replication_task" "t3micro-dms-replication-task" { | ||
# cdc_start_time = "1993-05-21T05:50:00Z" | ||
migration_type = "full-load" | ||
replication_instance_arn = var.dms_replication_instance_arn | ||
replication_task_id = "${var.database_name}-db-migration-task-tf" | ||
replication_task_settings = var.rep_task_settings_filepath | ||
source_endpoint_arn = aws_dms_endpoint.dms-rds-source.endpoint_arn | ||
table_mappings = var.rep_task_table_mapping_filepath | ||
target_endpoint_arn = aws_dms_s3_endpoint.dms-s3-csv-target.endpoint_arn | ||
|
||
# tags = merge( | ||
# local.tags, | ||
# { | ||
# Resource_Type = "DMS Replication Task", | ||
# } | ||
# ) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters