diff --git a/examples/replication_tasks.tf b/examples/replication_tasks.tf index 72ef2a6..082c608 100644 --- a/examples/replication_tasks.tf +++ b/examples/replication_tasks.tf @@ -3,13 +3,16 @@ variable "dms_replication_tasks" { default = {} } +variable "env" {} + resource "aws_dms_replication_task" "replication_tasks" { - for_each = var.dms_replication_tasks - migration_type = "full-load-and-cdc" - replication_instance_arn = aws_dms_replication_instance.dms-instance.replication_instance_arn - replication_task_id = each.value.name - source_endpoint_arn = aws_dms_endpoint.dms-endpoints[each.key].endpoint_arn - table_mappings = templatefile("templates/table_mapping.tpl", { tables = each.value.tables }) + for_each = var.dms_replication_tasks + migration_type = "full-load-and-cdc" + replication_instance_arn = aws_dms_replication_instance.dms-instance.replication_instance_arn + replication_task_id = each.value.name + source_endpoint_arn = aws_dms_endpoint.dms-endpoints[each.key].endpoint_arn + replication_task_settings = templatefile("templates/settings.tpl", { env = var.env, name = each.key }) + table_mappings = templatefile("templates/table_mapping.tpl", { tables = each.value.tables }) tags = merge( { @@ -20,3 +23,7 @@ resource "aws_dms_replication_task" "replication_tasks" { target_endpoint_arn = aws_dms_endpoint.dms-endpoints["reports-dms"].endpoint_arn } + +output "replication_task_arns" { + value = values(aws_dms_replication_task.replication_tasks)[*].replication_task_arn +}