Skip to content

Commit

Permalink
Add fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy Natarov authored and Vitaliy Natarov committed Aug 8, 2022
1 parent 163f33f commit 7748f8e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
43 changes: 21 additions & 22 deletions aws/examples/dms2/rds-replica-to-other-regions-one-stack/dms.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# AWS DMS source resources
#---------------------------------------------------------------
module "dms_replication" {
source = "../../../../aws/modules/dms2"
# "[email protected]:SebastianUA/terraform.git//aws/modules/dms2?ref=dev"
source = "[email protected]:SebastianUA/terraform.git//aws/modules/dms2?ref=dev"

providers = {
aws = aws.linux_notes_main
Expand All @@ -30,7 +29,7 @@ module "dms_replication" {
# Enable DMS endpoints
enable_dms_endpoint = true
dms_endpoints = {

# sources
source1 = {
endpoint_id = "${local.name}-${local.environment}-${local.dms_source_endpoint_properties["dms_endpoint_region"]}-dms-source-endpoint"
Expand Down Expand Up @@ -204,9 +203,9 @@ module "dms_replication" {
source_endpoint_key = "source1"
target_endpoint_key = "destination1"

migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.eucentral1_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered
migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.eucentral1_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered

cdc_start_time = ""
replication_task_settings = ""
Expand All @@ -216,9 +215,9 @@ module "dms_replication" {
source_endpoint_key = "source1"
target_endpoint_key = "destination2"

migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.euwest2_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered
migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.euwest2_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered

cdc_start_time = ""
replication_task_settings = ""
Expand All @@ -228,9 +227,9 @@ module "dms_replication" {
source_endpoint_key = "source1"
target_endpoint_key = "destination3"

migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.cacentral1_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered
migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.cacentral1_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered

cdc_start_time = ""
replication_task_settings = ""
Expand All @@ -240,9 +239,9 @@ module "dms_replication" {
source_endpoint_key = "source1"
target_endpoint_key = "destination4"

migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.apnortheast1_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered
migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.apnortheast1_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered

cdc_start_time = ""
replication_task_settings = ""
Expand All @@ -252,9 +251,9 @@ module "dms_replication" {
source_endpoint_key = "source1"
target_endpoint_key = "destination5"

migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.apsoutheast2_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered
migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.apsoutheast2_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered

cdc_start_time = ""
replication_task_settings = ""
Expand All @@ -264,9 +263,9 @@ module "dms_replication" {
source_endpoint_key = "source1"
target_endpoint_key = "destination6"

migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.westeurope_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered
migration_type = "full-load"
replication_task_id = "${local.name}-${local.environment}-${local.westeurope_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered

cdc_start_time = ""
replication_task_settings = ""
Expand All @@ -276,7 +275,7 @@ module "dms_replication" {
source_endpoint_key = "source1"
target_endpoint_key = "destination7"

migration_type = "full-load"
migration_type = "full-load"
# replication_task_id = "${local.name}-${local.environment}-${local.westus2_dms_target_endpoint_properties["dms_endpoint_region"]}-dms-replication-task"
table_mappings = data.template_file.table_mappings.rendered

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ module "dms-vpc-role" {
}

module "time_sleep" {
source = "../../../../time/modules/time"
# "[email protected]:SebastianUA/terraform.git//time/modules/time?ref=dev"
source = "[email protected]:SebastianUA/terraform.git//time/modules/time?ref=dev"

# Time sleep
enable_sleep = local.create_iams
Expand Down
6 changes: 3 additions & 3 deletions aws/modules/dms2/dms_replication_task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
resource "aws_dms_replication_task" "dms_replication_task" {
for_each = { for k, v in var.dms_replication_tasks : k => v if var.enable_dms_replication_task }

replication_task_id = lookup(each.value, "replication_task_id", "${lower(var.name)}-dms-replication-task-${lower(var.environment)}")
replication_task_id = lookup(each.value, "replication_task_id", "${lower(var.name)}-dms-replication-task-${lower(var.environment)}")
# lookup(each.value, "replication_task_id", "${lower(var.name)}-dms-replication-task-${lower(var.environment)}-${each.key + 1}")
migration_type = lookup(each.value, "migration_type", null)
replication_instance_arn = lookup(each.value, "replication_instance_arn", (var.enable_dms_replication_instance ? aws_dms_replication_instance.dms_replication_instance[0].replication_instance_arn : null))
source_endpoint_arn = lookup(each.value, "source_endpoint_arn", aws_dms_endpoint.dms_endpoint[each.value.source_endpoint_key].endpoint_arn)
# (var.enable_dms_endpoint ? aws_dms_endpoint.dms_endpoint[count.index].endpoint_arn : null)
target_endpoint_arn = lookup(each.value, "target_endpoint_arn", aws_dms_endpoint.dms_endpoint[each.value.target_endpoint_key].endpoint_arn)
table_mappings = lookup(each.value, "table_mappings", null)
target_endpoint_arn = lookup(each.value, "target_endpoint_arn", aws_dms_endpoint.dms_endpoint[each.value.target_endpoint_key].endpoint_arn)
table_mappings = lookup(each.value, "table_mappings", null)

cdc_start_time = lookup(each.value, "cdc_start_time", null)
replication_task_settings = lookup(each.value, "replication_task_settings", null)
Expand Down

0 comments on commit 7748f8e

Please sign in to comment.