@@ -126,23 +126,6 @@ module "dms_aurora_postgresql_aurora_mysql" {
126126 tags = { EndpointType = " postgresql-destination" }
127127 }
128128
129- postgresql-source = {
130- database_name = local.db_name
131- endpoint_id = " ${ local . name } -postgresql-source"
132- endpoint_type = " source"
133- engine_name = " aurora-postgresql"
134- extra_connection_attributes = " heartbeatFrequency=1;secretsManagerEndpointOverride=${ module . vpc_endpoints . endpoints [" secretsmanager" ][" dns_entry" ][0 ][" dns_name" ]} "
135- secrets_manager_arn = module.secrets_manager_postgresql.secret_arn
136-
137- postgres_settings = {
138- capture_ddls = false
139- heartbeat_enable = true
140- heartbeat_frequency = 1
141- }
142-
143- tags = { EndpointType = " postgresql-source" }
144- }
145-
146129 mysql-destination = {
147130 database_name = local.db_name
148131 endpoint_id = " ${ local . name } -mysql-destination"
@@ -190,7 +173,7 @@ module "dms_aurora_postgresql_aurora_mysql" {
190173 migration_type = " full-load-and-cdc"
191174 replication_task_settings = file (" configs/task_settings.json" )
192175 table_mappings = file (" configs/table_mappings.json" )
193- source_endpoint_key = " postgresql-source "
176+ source_endpoint_arn = aws_dms_endpoint.postgresql_source.endpoint_arn
194177 target_endpoint_key = " mysql-destination"
195178 tags = { Task = " PostgreSQL-to-MySQL" }
196179 }
@@ -199,7 +182,7 @@ module "dms_aurora_postgresql_aurora_mysql" {
199182 migration_type = " full-load-and-cdc"
200183 replication_task_settings = file (" configs/task_settings.json" )
201184 table_mappings = file (" configs/kafka_mappings.json" )
202- source_endpoint_key = " postgresql-source "
185+ source_endpoint_arn = aws_dms_endpoint.postgresql_source.endpoint_arn
203186 target_endpoint_key = " kafka-destination"
204187 tags = { Task = " PostgreSQL-to-Kafka" }
205188 }
@@ -528,3 +511,22 @@ module "secrets_manager_mysql" {
528511
529512 tags = local. tags
530513}
514+
515+ resource "aws_dms_endpoint" "postgresql_source" {
516+ database_name = local. db_name
517+ endpoint_id = " ${ local . name } -postgresql-source"
518+ endpoint_type = " source"
519+ engine_name = " aurora-postgresql"
520+ extra_connection_attributes = " heartbeatFrequency=1;secretsManagerEndpointOverride=${ module . vpc_endpoints . endpoints [" secretsmanager" ][" dns_entry" ][0 ][" dns_name" ]} "
521+
522+ secrets_manager_arn = module. secrets_manager_postgresql . secret_arn
523+ secrets_manager_access_role_arn = module. dms_aurora_postgresql_aurora_mysql . access_iam_role_arn
524+
525+ postgres_settings {
526+ capture_ddls = false
527+ heartbeat_enable = true
528+ heartbeat_frequency = 1
529+ }
530+
531+ tags = { EndpointType = " postgresql-source" }
532+ }
0 commit comments