From de8b9cbcc46846a2e9888743f798320b723e5980 Mon Sep 17 00:00:00 2001 From: Fernando Mez Date: Tue, 5 Apr 2022 21:11:53 -0300 Subject: [PATCH 01/14] Fix replication task lifecycle. --- internal/service/dms/replication_task.go | 44 +++++++++++------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/internal/service/dms/replication_task.go b/internal/service/dms/replication_task.go index 3c8f3b105644..572747f6b4f2 100644 --- a/internal/service/dms/replication_task.go +++ b/internal/service/dms/replication_task.go @@ -253,8 +253,18 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err input.TableMappings = aws.String(d.Get("table_mappings").(string)) } - log.Println("[DEBUG] DMS update replication task:", input) + log.Println("[INFO] DMS update replication task:", input) + status := d.Get("status").(string) + log.Println("[INFO] STATUS 2 ----------:", status) + if status == replicationTaskStatusRunning { + log.Println("[INFO] DMS stopping replication task 1:", d.Id()) + if err := stopReplicationTask(d.Id(), conn); err != nil { + return err + } + } + + log.Println("[INFO] DMS modifying replication task:", d.Id()) _, err := conn.ModifyReplicationTask(input) if err != nil { return fmt.Errorf("error updating DMS Replication Task (%s): %w", d.Id(), err) @@ -263,28 +273,14 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err if err := waitReplicationTaskModified(conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { return fmt.Errorf("error waiting for DMS Replication Task (%s) update: %s", d.Id(), err) } - - if d.Get("start_replication_task").(bool) { - if err := startReplicationTask(d.Id(), conn); err != nil { - return err - } - } + log.Println("[INFO] DMS replication task was modified.", d.Id()) } - if d.HasChanges("start_replication_task") { - status := d.Get("status").(string) - if d.Get("start_replication_task").(bool) { - if status != replicationTaskStatusRunning { - if err := startReplicationTask(d.Id(), conn); err != nil { - return err - } - } - } else { - if status == replicationTaskStatusRunning { - if err := stopReplicationTask(d.Id(), conn); err != nil { - return err - } - } + log.Println("[INFO] START_REPLICATION_TASK ----------:", d.Get("start_replication_task")) + if d.Get("start_replication_task").(bool) { + log.Println("[INFO] DMS starting replication task:", d.Id()) + if err := startReplicationTask(d.Id(), conn); err != nil { + return err } } @@ -384,14 +380,14 @@ func startReplicationTask(id string, conn *dms.DatabaseMigrationService) error { err = waitReplicationTaskRunning(conn, id) if err != nil { - return fmt.Errorf("error wating for DMS Replication Task (%s) start: %w", id, err) + return fmt.Errorf("error waiting for DMS Replication Task (%s) start: %w", id, err) } return nil } func stopReplicationTask(id string, conn *dms.DatabaseMigrationService) error { - log.Printf("[DEBUG] Stopping DMS Replication Task: (%s)", id) + log.Printf("[ERROR] Stopping DMS Replication Task: (%s)", id) task, err := FindReplicationTaskByID(conn, id) if err != nil { @@ -412,7 +408,7 @@ func stopReplicationTask(id string, conn *dms.DatabaseMigrationService) error { err = waitReplicationTaskStopped(conn, id) if err != nil { - return fmt.Errorf("error wating for DMS Replication Task (%s) stop: %w", id, err) + return fmt.Errorf("error waiting for DMS Replication Task (%s) stop: %w", id, err) } return nil From b72e4b1a96288479d5bd52a67f7295e6709fbae1 Mon Sep 17 00:00:00 2001 From: Fernando Mez Date: Tue, 5 Apr 2022 21:15:58 -0300 Subject: [PATCH 02/14] Clean up debug logging --- internal/service/dms/replication_task.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/internal/service/dms/replication_task.go b/internal/service/dms/replication_task.go index 572747f6b4f2..316c8486a4c3 100644 --- a/internal/service/dms/replication_task.go +++ b/internal/service/dms/replication_task.go @@ -253,18 +253,15 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err input.TableMappings = aws.String(d.Get("table_mappings").(string)) } - log.Println("[INFO] DMS update replication task:", input) - status := d.Get("status").(string) - log.Println("[INFO] STATUS 2 ----------:", status) if status == replicationTaskStatusRunning { - log.Println("[INFO] DMS stopping replication task 1:", d.Id()) + log.Println("[DEBUG] stopping DMS replication task:", input) if err := stopReplicationTask(d.Id(), conn); err != nil { return err } } - log.Println("[INFO] DMS modifying replication task:", d.Id()) + log.Println("[DEBUG] updating DMS replication task:", input) _, err := conn.ModifyReplicationTask(input) if err != nil { return fmt.Errorf("error updating DMS Replication Task (%s): %w", d.Id(), err) @@ -273,12 +270,10 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err if err := waitReplicationTaskModified(conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { return fmt.Errorf("error waiting for DMS Replication Task (%s) update: %s", d.Id(), err) } - log.Println("[INFO] DMS replication task was modified.", d.Id()) } - log.Println("[INFO] START_REPLICATION_TASK ----------:", d.Get("start_replication_task")) if d.Get("start_replication_task").(bool) { - log.Println("[INFO] DMS starting replication task:", d.Id()) + log.Println("[INFO] starting DMS replication task:", d.Id()) if err := startReplicationTask(d.Id(), conn); err != nil { return err } @@ -387,7 +382,7 @@ func startReplicationTask(id string, conn *dms.DatabaseMigrationService) error { } func stopReplicationTask(id string, conn *dms.DatabaseMigrationService) error { - log.Printf("[ERROR] Stopping DMS Replication Task: (%s)", id) + log.Printf("[DEBUG] Stopping DMS Replication Task: (%s)", id) task, err := FindReplicationTaskByID(conn, id) if err != nil { From 3fe3cb596a3317c5509f8d0aceb9843125b7b978 Mon Sep 17 00:00:00 2001 From: Fernando Mez Date: Wed, 6 Apr 2022 12:34:34 -0300 Subject: [PATCH 03/14] Fix --- internal/service/dms/replication_task.go | 28 ++++++++-- internal/service/dms/replication_task_test.go | 51 +++++++++++++++---- 2 files changed, 65 insertions(+), 14 deletions(-) diff --git a/internal/service/dms/replication_task.go b/internal/service/dms/replication_task.go index 316c8486a4c3..cfab292f55f8 100644 --- a/internal/service/dms/replication_task.go +++ b/internal/service/dms/replication_task.go @@ -223,6 +223,7 @@ func resourceReplicationTaskRead(d *schema.ResourceData, meta interface{}) error func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*conns.AWSClient).DMSConn + status := d.Get("status").(string) if d.HasChangesExcept("tags", "tags_all", "start_replication_task") { input := &dms.ModifyReplicationTaskInput{ @@ -253,7 +254,6 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err input.TableMappings = aws.String(d.Get("table_mappings").(string)) } - status := d.Get("status").(string) if status == replicationTaskStatusRunning { log.Println("[DEBUG] stopping DMS replication task:", input) if err := stopReplicationTask(d.Id(), conn); err != nil { @@ -270,12 +270,30 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err if err := waitReplicationTaskModified(conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { return fmt.Errorf("error waiting for DMS Replication Task (%s) update: %s", d.Id(), err) } + + if d.Get("start_replication_task").(bool) { + err := startReplicationTask(d.Id(), conn) + if err != nil { + return err + } else { + status = replicationTaskStatusRunning + } + } } - if d.Get("start_replication_task").(bool) { - log.Println("[INFO] starting DMS replication task:", d.Id()) - if err := startReplicationTask(d.Id(), conn); err != nil { - return err + if d.HasChanges("start_replication_task") { + if d.Get("start_replication_task").(bool) { + if status != replicationTaskStatusRunning { + if err := startReplicationTask(d.Id(), conn); err != nil { + return err + } + } + } else { + if status == replicationTaskStatusRunning { + if err := stopReplicationTask(d.Id(), conn); err != nil { + return err + } + } } } diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index 7cc0aed6f941..309bffd04622 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -2,6 +2,7 @@ package dms_test import ( "fmt" + // "strings" "testing" dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" @@ -115,6 +116,13 @@ func TestAccDMSReplicationTask_startReplicationTask(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"start_replication_task"}, }, + // { + // Config: strings.Replace(dmsReplicationTaskConfigStartReplicationTask(rName, true), "%%", "default", 1), + // Check: resource.ComposeTestCheckFunc( + // testAccCheckReplicationTaskExists(resourceName), + // resource.TestCheckResourceAttr(resourceName, "status", "running"), + // ), + // }, { Config: dmsReplicationTaskConfigStartReplicationTask(rName, false), Check: resource.ComposeTestCheckFunc( @@ -351,16 +359,41 @@ resource "aws_db_subnet_group" "test" { } } +resource "aws_rds_cluster_parameter_group" "test" { + name = "%[1]s-pg-cluster" + family = "aurora-mysql5.7" + description = "DMS cluster parameter group" + + parameter { + name = "binlog_format" + value = "ROW" + apply_method = "pending-reboot" + } + + parameter { + name = "binlog_row_image" + value = "Full" + apply_method = "pending-reboot" + } + + parameter { + name = "binlog_checksum" + value = "NONE" + apply_method = "pending-reboot" + } +} + resource "aws_rds_cluster" "test1" { - cluster_identifier = "%[1]s-aurora-cluster-source" - engine = "aurora-mysql" - engine_version = "5.7.mysql_aurora.2.03.2" - database_name = "tftest" - master_username = "tftest" - master_password = "mustbeeightcharaters" - skip_final_snapshot = true - vpc_security_group_ids = [aws_default_security_group.test.id] - db_subnet_group_name = aws_db_subnet_group.test.name + cluster_identifier = "%[1]s-aurora-cluster-source" + engine = "aurora-mysql" + engine_version = "5.7.mysql_aurora.2.03.2" + database_name = "tftest" + master_username = "tftest" + master_password = "mustbeeightcharaters" + skip_final_snapshot = true + vpc_security_group_ids = [aws_default_security_group.test.id] + db_subnet_group_name = aws_db_subnet_group.test.name + db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.test.name } resource "aws_rds_cluster_instance" "test1" { From befba7ed466d27dc1b4fe18ec58b5216ed73dbc9 Mon Sep 17 00:00:00 2001 From: Fernando Mez Date: Wed, 6 Apr 2022 13:05:41 -0300 Subject: [PATCH 04/14] tabs vs spaces i hate go --- internal/service/dms/replication_task_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index 309bffd04622..637a20bbfcba 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -367,19 +367,19 @@ resource "aws_rds_cluster_parameter_group" "test" { parameter { name = "binlog_format" value = "ROW" - apply_method = "pending-reboot" + apply_method = "pending-reboot" } parameter { name = "binlog_row_image" value = "Full" - apply_method = "pending-reboot" + apply_method = "pending-reboot" } parameter { name = "binlog_checksum" value = "NONE" - apply_method = "pending-reboot" + apply_method = "pending-reboot" } } @@ -393,7 +393,7 @@ resource "aws_rds_cluster" "test1" { skip_final_snapshot = true vpc_security_group_ids = [aws_default_security_group.test.id] db_subnet_group_name = aws_db_subnet_group.test.name - db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.test.name + db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.test.name } resource "aws_rds_cluster_instance" "test1" { From 0cc6828b7d4b4df8626aa8d20ff12a18095c6dc6 Mon Sep 17 00:00:00 2001 From: Fernando Mez Date: Wed, 6 Apr 2022 13:11:01 -0300 Subject: [PATCH 05/14] Add changelog --- .changelog/24047.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/24047.txt diff --git a/.changelog/24047.txt b/.changelog/24047.txt new file mode 100644 index 000000000000..4ca6c6904d99 --- /dev/null +++ b/.changelog/24047.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_dms_replication_task: Fix when updating the task, it's is now stopped before, if required. +``` From 8717eac2b73b55495f8860f313043867ccd23ebf Mon Sep 17 00:00:00 2001 From: Fernando Mez Date: Wed, 6 Apr 2022 20:42:59 -0300 Subject: [PATCH 06/14] Fix acc test --- internal/service/dms/replication_task.go | 15 +++++++---- internal/service/dms/replication_task_test.go | 26 +++++++++---------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/internal/service/dms/replication_task.go b/internal/service/dms/replication_task.go index cfab292f55f8..fa361c4ad7fa 100644 --- a/internal/service/dms/replication_task.go +++ b/internal/service/dms/replication_task.go @@ -155,7 +155,7 @@ func resourceReplicationTaskCreate(d *schema.ResourceData, meta interface{}) err } if d.Get("start_replication_task").(bool) { - if err := startReplicationTask(d.Id(), conn); err != nil { + if err := startReplicationTask(d.Id(), conn, replicationTaskStatusReady); err != nil { return err } } @@ -272,7 +272,7 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err } if d.Get("start_replication_task").(bool) { - err := startReplicationTask(d.Id(), conn) + err := startReplicationTask(d.Id(), conn, replicationTaskStatusStopped) if err != nil { return err } else { @@ -284,7 +284,7 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err if d.HasChanges("start_replication_task") { if d.Get("start_replication_task").(bool) { if status != replicationTaskStatusRunning { - if err := startReplicationTask(d.Id(), conn); err != nil { + if err := startReplicationTask(d.Id(), conn, status); err != nil { return err } } @@ -370,7 +370,7 @@ func dmsReplicationTaskRemoveReadOnlySettings(settings string) (*string, error) return &cleanedSettingsString, nil } -func startReplicationTask(id string, conn *dms.DatabaseMigrationService) error { +func startReplicationTask(id string, conn *dms.DatabaseMigrationService, fromStatus string) error { log.Printf("[DEBUG] Starting DMS Replication Task: (%s)", id) task, err := FindReplicationTaskByID(conn, id) @@ -382,9 +382,14 @@ func startReplicationTask(id string, conn *dms.DatabaseMigrationService) error { return fmt.Errorf("error reading DMS Replication Task (%s): empty output", id) } + startReplicationTaskType := dms.StartReplicationTaskTypeValueStartReplication + if fromStatus != replicationTaskStatusReady { + startReplicationTaskType = dms.StartReplicationTaskTypeValueResumeProcessing + } + _, err = conn.StartReplicationTask(&dms.StartReplicationTaskInput{ ReplicationTaskArn: task.ReplicationTaskArn, - StartReplicationTaskType: aws.String(dms.StartReplicationTaskTypeValueStartReplication), + StartReplicationTaskType: aws.String(startReplicationTaskType), }) if err != nil { diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index 637a20bbfcba..9a36eb18f27c 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -2,7 +2,7 @@ package dms_test import ( "fmt" - // "strings" + "strings" "testing" dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" @@ -104,7 +104,14 @@ func TestAccDMSReplicationTask_startReplicationTask(t *testing.T) { CheckDestroy: testAccCheckReplicationTaskDestroy, Steps: []resource.TestStep{ { - Config: dmsReplicationTaskConfigStartReplicationTask(rName, true), + Config: dmsReplicationTaskConfigStartReplicationTask(rName, true, "testrule"), + Check: resource.ComposeTestCheckFunc( + testAccCheckReplicationTaskExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "status", "running"), + ), + }, + { + Config: dmsReplicationTaskConfigStartReplicationTask(rName, true, "changedtestrule"), Check: resource.ComposeTestCheckFunc( testAccCheckReplicationTaskExists(resourceName), resource.TestCheckResourceAttr(resourceName, "status", "running"), @@ -116,15 +123,8 @@ func TestAccDMSReplicationTask_startReplicationTask(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"start_replication_task"}, }, - // { - // Config: strings.Replace(dmsReplicationTaskConfigStartReplicationTask(rName, true), "%%", "default", 1), - // Check: resource.ComposeTestCheckFunc( - // testAccCheckReplicationTaskExists(resourceName), - // resource.TestCheckResourceAttr(resourceName, "status", "running"), - // ), - // }, { - Config: dmsReplicationTaskConfigStartReplicationTask(rName, false), + Config: dmsReplicationTaskConfigStartReplicationTask(rName, false, "changedtestrule"), Check: resource.ComposeTestCheckFunc( testAccCheckReplicationTaskExists(resourceName), resource.TestCheckResourceAttr(resourceName, "status", "stopped"), @@ -296,7 +296,7 @@ resource "aws_dms_replication_task" "test" { `, cdcStartPosition, rName)) } -func dmsReplicationTaskConfigStartReplicationTask(rName string, startTask bool) string { +func dmsReplicationTaskConfigStartReplicationTask(rName string, startTask bool, ruleName string) string { return acctest.ConfigCompose( acctest.ConfigAvailableAZsNoOptIn(), fmt.Sprintf(` @@ -471,7 +471,7 @@ resource "aws_dms_replication_task" "test" { replication_task_id = %[1]q replication_task_settings = "{\"BeforeImageSettings\":null,\"FailTaskWhenCleanTaskResourceFailed\":false,\"ChangeProcessingDdlHandlingPolicy\":{\"HandleSourceTableAltered\":true,\"HandleSourceTableDropped\":true,\"HandleSourceTableTruncated\":true},\"ChangeProcessingTuning\":{\"BatchApplyMemoryLimit\":500,\"BatchApplyPreserveTransaction\":true,\"BatchApplyTimeoutMax\":30,\"BatchApplyTimeoutMin\":1,\"BatchSplitSize\":0,\"CommitTimeout\":1,\"MemoryKeepTime\":60,\"MemoryLimitTotal\":1024,\"MinTransactionSize\":1000,\"StatementCacheSize\":50},\"CharacterSetSettings\":null,\"ControlTablesSettings\":{\"ControlSchema\":\"\",\"FullLoadExceptionTableEnabled\":false,\"HistoryTableEnabled\":false,\"HistoryTimeslotInMinutes\":5,\"StatusTableEnabled\":false,\"SuspendedTablesTableEnabled\":false},\"ErrorBehavior\":{\"ApplyErrorDeletePolicy\":\"IGNORE_RECORD\",\"ApplyErrorEscalationCount\":0,\"ApplyErrorEscalationPolicy\":\"LOG_ERROR\",\"ApplyErrorFailOnTruncationDdl\":false,\"ApplyErrorInsertPolicy\":\"LOG_ERROR\",\"ApplyErrorUpdatePolicy\":\"LOG_ERROR\",\"DataErrorEscalationCount\":0,\"DataErrorEscalationPolicy\":\"SUSPEND_TABLE\",\"DataErrorPolicy\":\"LOG_ERROR\",\"DataTruncationErrorPolicy\":\"LOG_ERROR\",\"FailOnNoTablesCaptured\":false,\"FailOnTransactionConsistencyBreached\":false,\"FullLoadIgnoreConflicts\":true,\"RecoverableErrorCount\":-1,\"RecoverableErrorInterval\":5,\"RecoverableErrorStopRetryAfterThrottlingMax\":false,\"RecoverableErrorThrottling\":true,\"RecoverableErrorThrottlingMax\":1800,\"TableErrorEscalationCount\":0,\"TableErrorEscalationPolicy\":\"STOP_TASK\",\"TableErrorPolicy\":\"SUSPEND_TABLE\"},\"FullLoadSettings\":{\"CommitRate\":10000,\"CreatePkAfterFullLoad\":false,\"MaxFullLoadSubTasks\":8,\"StopTaskCachedChangesApplied\":false,\"StopTaskCachedChangesNotApplied\":false,\"TargetTablePrepMode\":\"DROP_AND_CREATE\",\"TransactionConsistencyTimeout\":600},\"Logging\":{\"EnableLogging\":false,\"LogComponents\":[{\"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\",\"Severity\":\"LOGGER_SEVERITY_DEFAULT\"}]},\"LoopbackPreventionSettings\":null,\"PostProcessingRules\":null,\"StreamBufferSettings\":{\"CtrlStreamBufferSizeInMB\":5,\"StreamBufferCount\":3,\"StreamBufferSizeInMB\":8},\"TargetMetadata\":{\"BatchApplyEnabled\":false,\"FullLobMode\":false,\"InlineLobMaxSize\":0,\"LimitedSizeLobMode\":true,\"LoadMaxFileSize\":0,\"LobChunkSize\":0,\"LobMaxSize\":32,\"ParallelApplyBufferSize\":0,\"ParallelApplyQueuesPerThread\":0,\"ParallelApplyThreads\":0,\"ParallelLoadBufferSize\":0,\"ParallelLoadQueuesPerThread\":0,\"ParallelLoadThreads\":0,\"SupportLobs\":true,\"TargetSchema\":\"\",\"TaskRecoveryTableEnabled\":false},\"TTSettings\":{\"EnableTT\":false,\"TTRecordSettings\":null,\"TTS3Settings\":null}}" source_endpoint_arn = aws_dms_endpoint.source.endpoint_arn - table_mappings = "{\"rules\":[{\"rule-type\":\"selection\",\"rule-id\":\"1\",\"rule-name\":\"1\",\"object-locator\":{\"schema-name\":\"%%\",\"table-name\":\"%%\"},\"rule-action\":\"include\"}]}" + table_mappings = "{\"rules\":[{\"rule-type\":\"selection\",\"rule-id\":\"1\",\"rule-name\":\"%[3]s\",\"object-locator\":{\"schema-name\":\"%%\",\"table-name\":\"%%\"},\"rule-action\":\"include\"}]}" start_replication_task = %[2]t @@ -483,5 +483,5 @@ resource "aws_dms_replication_task" "test" { depends_on = [aws_rds_cluster_instance.test1, aws_rds_cluster_instance.test2] } -`, rName, startTask)) +`, rName, startTask, ruleName)) } From e73eaab37c135265ee89a59b4186f8bf96eeb542 Mon Sep 17 00:00:00 2001 From: Fernando Mez Date: Wed, 6 Apr 2022 20:51:54 -0300 Subject: [PATCH 07/14] extra import --- internal/service/dms/replication_task_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index 9a36eb18f27c..3935175a5139 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -2,7 +2,6 @@ package dms_test import ( "fmt" - "strings" "testing" dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" From bab949d8e16d555825c2fa3157e37c085215d3b7 Mon Sep 17 00:00:00 2001 From: Fernando Mez Date: Thu, 7 Apr 2022 01:05:23 -0300 Subject: [PATCH 08/14] Simplify changelog --- .changelog/24047.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/24047.txt b/.changelog/24047.txt index 4ca6c6904d99..e7befef2a4e8 100644 --- a/.changelog/24047.txt +++ b/.changelog/24047.txt @@ -1,3 +1,3 @@ ```release-note:bug -resource/aws_dms_replication_task: Fix when updating the task, it's is now stopped before, if required. +resource/aws_dms_replication_task: Fix: The task is now stopped before updating it, if required. ``` From 330942ac2a81f2405d1c759c6c1b42fc48c696e8 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 26 Apr 2022 11:55:05 -0400 Subject: [PATCH 09/14] r/aws_replication_task: acctest fmt --- internal/service/dms/replication_task_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index 3935175a5139..6ef4af652155 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -364,20 +364,20 @@ resource "aws_rds_cluster_parameter_group" "test" { description = "DMS cluster parameter group" parameter { - name = "binlog_format" - value = "ROW" + name = "binlog_format" + value = "ROW" apply_method = "pending-reboot" } parameter { - name = "binlog_row_image" - value = "Full" + name = "binlog_row_image" + value = "Full" apply_method = "pending-reboot" } parameter { - name = "binlog_checksum" - value = "NONE" + name = "binlog_checksum" + value = "NONE" apply_method = "pending-reboot" } } From ad14c8e25371e342b04af41a94888fb6b9c330ae Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 26 Apr 2022 12:05:39 -0400 Subject: [PATCH 10/14] r/aws_replication_task: rearrage test steps --- internal/service/dms/replication_task_test.go | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index 6ef4af652155..fbbe3b404ed5 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -103,14 +103,7 @@ func TestAccDMSReplicationTask_startReplicationTask(t *testing.T) { CheckDestroy: testAccCheckReplicationTaskDestroy, Steps: []resource.TestStep{ { - Config: dmsReplicationTaskConfigStartReplicationTask(rName, true, "testrule"), - Check: resource.ComposeTestCheckFunc( - testAccCheckReplicationTaskExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "status", "running"), - ), - }, - { - Config: dmsReplicationTaskConfigStartReplicationTask(rName, true, "changedtestrule"), + Config: testAccReplicationTaskConfigStartReplicationTask(rName, true, "testrule"), Check: resource.ComposeTestCheckFunc( testAccCheckReplicationTaskExists(resourceName), resource.TestCheckResourceAttr(resourceName, "status", "running"), @@ -123,7 +116,14 @@ func TestAccDMSReplicationTask_startReplicationTask(t *testing.T) { ImportStateVerifyIgnore: []string{"start_replication_task"}, }, { - Config: dmsReplicationTaskConfigStartReplicationTask(rName, false, "changedtestrule"), + Config: testAccReplicationTaskConfigStartReplicationTask(rName, true, "changedtestrule"), + Check: resource.ComposeTestCheckFunc( + testAccCheckReplicationTaskExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "status", "running"), + ), + }, + { + Config: testAccReplicationTaskConfigStartReplicationTask(rName, false, "changedtestrule"), Check: resource.ComposeTestCheckFunc( testAccCheckReplicationTaskExists(resourceName), resource.TestCheckResourceAttr(resourceName, "status", "stopped"), @@ -295,7 +295,7 @@ resource "aws_dms_replication_task" "test" { `, cdcStartPosition, rName)) } -func dmsReplicationTaskConfigStartReplicationTask(rName string, startTask bool, ruleName string) string { +func testAccReplicationTaskConfigStartReplicationTask(rName string, startTask bool, ruleName string) string { return acctest.ConfigCompose( acctest.ConfigAvailableAZsNoOptIn(), fmt.Sprintf(` From fa738a516c24aca92af10a29a1d51e6b959369be Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 26 Apr 2022 13:16:26 -0400 Subject: [PATCH 11/14] r/aws_replication_task: check task status using find results --- internal/service/dms/replication_task.go | 15 +++++++-------- internal/service/dms/replication_task_test.go | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/internal/service/dms/replication_task.go b/internal/service/dms/replication_task.go index fa361c4ad7fa..2f5d63c88567 100644 --- a/internal/service/dms/replication_task.go +++ b/internal/service/dms/replication_task.go @@ -155,7 +155,7 @@ func resourceReplicationTaskCreate(d *schema.ResourceData, meta interface{}) err } if d.Get("start_replication_task").(bool) { - if err := startReplicationTask(d.Id(), conn, replicationTaskStatusReady); err != nil { + if err := startReplicationTask(d.Id(), conn); err != nil { return err } } @@ -223,7 +223,6 @@ func resourceReplicationTaskRead(d *schema.ResourceData, meta interface{}) error func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*conns.AWSClient).DMSConn - status := d.Get("status").(string) if d.HasChangesExcept("tags", "tags_all", "start_replication_task") { input := &dms.ModifyReplicationTaskInput{ @@ -254,6 +253,7 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err input.TableMappings = aws.String(d.Get("table_mappings").(string)) } + status := d.Get("status").(string) if status == replicationTaskStatusRunning { log.Println("[DEBUG] stopping DMS replication task:", input) if err := stopReplicationTask(d.Id(), conn); err != nil { @@ -272,19 +272,18 @@ func resourceReplicationTaskUpdate(d *schema.ResourceData, meta interface{}) err } if d.Get("start_replication_task").(bool) { - err := startReplicationTask(d.Id(), conn, replicationTaskStatusStopped) + err := startReplicationTask(d.Id(), conn) if err != nil { return err - } else { - status = replicationTaskStatusRunning } } } if d.HasChanges("start_replication_task") { + status := d.Get("status").(string) if d.Get("start_replication_task").(bool) { if status != replicationTaskStatusRunning { - if err := startReplicationTask(d.Id(), conn, status); err != nil { + if err := startReplicationTask(d.Id(), conn); err != nil { return err } } @@ -370,7 +369,7 @@ func dmsReplicationTaskRemoveReadOnlySettings(settings string) (*string, error) return &cleanedSettingsString, nil } -func startReplicationTask(id string, conn *dms.DatabaseMigrationService, fromStatus string) error { +func startReplicationTask(id string, conn *dms.DatabaseMigrationService) error { log.Printf("[DEBUG] Starting DMS Replication Task: (%s)", id) task, err := FindReplicationTaskByID(conn, id) @@ -383,7 +382,7 @@ func startReplicationTask(id string, conn *dms.DatabaseMigrationService, fromSta } startReplicationTaskType := dms.StartReplicationTaskTypeValueStartReplication - if fromStatus != replicationTaskStatusReady { + if aws.StringValue(task.Status) != replicationTaskStatusReady { startReplicationTaskType = dms.StartReplicationTaskTypeValueResumeProcessing } diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index fbbe3b404ed5..0bde9ef8d187 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -468,7 +468,7 @@ resource "aws_dms_replication_task" "test" { migration_type = "full-load-and-cdc" replication_instance_arn = aws_dms_replication_instance.test.replication_instance_arn replication_task_id = %[1]q - replication_task_settings = "{\"BeforeImageSettings\":null,\"FailTaskWhenCleanTaskResourceFailed\":false,\"ChangeProcessingDdlHandlingPolicy\":{\"HandleSourceTableAltered\":true,\"HandleSourceTableDropped\":true,\"HandleSourceTableTruncated\":true},\"ChangeProcessingTuning\":{\"BatchApplyMemoryLimit\":500,\"BatchApplyPreserveTransaction\":true,\"BatchApplyTimeoutMax\":30,\"BatchApplyTimeoutMin\":1,\"BatchSplitSize\":0,\"CommitTimeout\":1,\"MemoryKeepTime\":60,\"MemoryLimitTotal\":1024,\"MinTransactionSize\":1000,\"StatementCacheSize\":50},\"CharacterSetSettings\":null,\"ControlTablesSettings\":{\"ControlSchema\":\"\",\"FullLoadExceptionTableEnabled\":false,\"HistoryTableEnabled\":false,\"HistoryTimeslotInMinutes\":5,\"StatusTableEnabled\":false,\"SuspendedTablesTableEnabled\":false},\"ErrorBehavior\":{\"ApplyErrorDeletePolicy\":\"IGNORE_RECORD\",\"ApplyErrorEscalationCount\":0,\"ApplyErrorEscalationPolicy\":\"LOG_ERROR\",\"ApplyErrorFailOnTruncationDdl\":false,\"ApplyErrorInsertPolicy\":\"LOG_ERROR\",\"ApplyErrorUpdatePolicy\":\"LOG_ERROR\",\"DataErrorEscalationCount\":0,\"DataErrorEscalationPolicy\":\"SUSPEND_TABLE\",\"DataErrorPolicy\":\"LOG_ERROR\",\"DataTruncationErrorPolicy\":\"LOG_ERROR\",\"FailOnNoTablesCaptured\":false,\"FailOnTransactionConsistencyBreached\":false,\"FullLoadIgnoreConflicts\":true,\"RecoverableErrorCount\":-1,\"RecoverableErrorInterval\":5,\"RecoverableErrorStopRetryAfterThrottlingMax\":false,\"RecoverableErrorThrottling\":true,\"RecoverableErrorThrottlingMax\":1800,\"TableErrorEscalationCount\":0,\"TableErrorEscalationPolicy\":\"STOP_TASK\",\"TableErrorPolicy\":\"SUSPEND_TABLE\"},\"FullLoadSettings\":{\"CommitRate\":10000,\"CreatePkAfterFullLoad\":false,\"MaxFullLoadSubTasks\":8,\"StopTaskCachedChangesApplied\":false,\"StopTaskCachedChangesNotApplied\":false,\"TargetTablePrepMode\":\"DROP_AND_CREATE\",\"TransactionConsistencyTimeout\":600},\"Logging\":{\"EnableLogging\":false,\"LogComponents\":[{\"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\",\"Severity\":\"LOGGER_SEVERITY_DEFAULT\"}]},\"LoopbackPreventionSettings\":null,\"PostProcessingRules\":null,\"StreamBufferSettings\":{\"CtrlStreamBufferSizeInMB\":5,\"StreamBufferCount\":3,\"StreamBufferSizeInMB\":8},\"TargetMetadata\":{\"BatchApplyEnabled\":false,\"FullLobMode\":false,\"InlineLobMaxSize\":0,\"LimitedSizeLobMode\":true,\"LoadMaxFileSize\":0,\"LobChunkSize\":0,\"LobMaxSize\":32,\"ParallelApplyBufferSize\":0,\"ParallelApplyQueuesPerThread\":0,\"ParallelApplyThreads\":0,\"ParallelLoadBufferSize\":0,\"ParallelLoadQueuesPerThread\":0,\"ParallelLoadThreads\":0,\"SupportLobs\":true,\"TargetSchema\":\"\",\"TaskRecoveryTableEnabled\":false},\"TTSettings\":{\"EnableTT\":false,\"TTRecordSettings\":null,\"TTS3Settings\":null}}" + replication_task_settings = "{\"BeforeImageSettings\":null,\"FailTaskWhenCleanTaskResourceFailed\":false,\"ChangeProcessingDdlHandlingPolicy\":{\"HandleSourceTableAltered\":true,\"HandleSourceTableDropped\":true,\"HandleSourceTableTruncated\":true},\"ChangeProcessingTuning\":{\"BatchApplyMemoryLimit\":500,\"BatchApplyPreserveTransaction\":true,\"BatchApplyTimeoutMax\":30,\"BatchApplyTimeoutMin\":1,\"BatchSplitSize\":0,\"CommitTimeout\":1,\"MemoryKeepTime\":60,\"MemoryLimitTotal\":1024,\"MinTransactionSize\":1000,\"StatementCacheSize\":50},\"CharacterSetSettings\":null,\"ControlTablesSettings\":{\"ControlSchema\":\"\",\"FullLoadExceptionTableEnabled\":false,\"HistoryTableEnabled\":false,\"HistoryTimeslotInMinutes\":5,\"StatusTableEnabled\":false,\"SuspendedTablesTableEnabled\":false},\"ErrorBehavior\":{\"ApplyErrorDeletePolicy\":\"IGNORE_RECORD\",\"ApplyErrorEscalationCount\":0,\"ApplyErrorEscalationPolicy\":\"LOG_ERROR\",\"ApplyErrorFailOnTruncationDdl\":false,\"ApplyErrorInsertPolicy\":\"LOG_ERROR\",\"ApplyErrorUpdatePolicy\":\"LOG_ERROR\",\"DataErrorEscalationCount\":0,\"DataErrorEscalationPolicy\":\"SUSPEND_TABLE\",\"DataErrorPolicy\":\"LOG_ERROR\",\"DataTruncationErrorPolicy\":\"LOG_ERROR\",\"EventErrorPolicy\":null,\"FailOnNoTablesCaptured\":false,\"FailOnTransactionConsistencyBreached\":false,\"FullLoadIgnoreConflicts\":true,\"RecoverableErrorCount\":-1,\"RecoverableErrorInterval\":5,\"RecoverableErrorStopRetryAfterThrottlingMax\":false,\"RecoverableErrorThrottling\":true,\"RecoverableErrorThrottlingMax\":1800,\"TableErrorEscalationCount\":0,\"TableErrorEscalationPolicy\":\"STOP_TASK\",\"TableErrorPolicy\":\"SUSPEND_TABLE\"},\"FullLoadSettings\":{\"CommitRate\":10000,\"CreatePkAfterFullLoad\":false,\"MaxFullLoadSubTasks\":8,\"StopTaskCachedChangesApplied\":false,\"StopTaskCachedChangesNotApplied\":false,\"TargetTablePrepMode\":\"DROP_AND_CREATE\",\"TransactionConsistencyTimeout\":600},\"Logging\":{\"EnableLogging\":false,\"LogComponents\":[{\"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\",\"Severity\":\"LOGGER_SEVERITY_DEFAULT\"}]},\"LoopbackPreventionSettings\":null,\"PostProcessingRules\":null,\"StreamBufferSettings\":{\"CtrlStreamBufferSizeInMB\":5,\"StreamBufferCount\":3,\"StreamBufferSizeInMB\":8},\"TargetMetadata\":{\"BatchApplyEnabled\":false,\"FullLobMode\":false,\"InlineLobMaxSize\":0,\"LimitedSizeLobMode\":true,\"LoadMaxFileSize\":0,\"LobChunkSize\":0,\"LobMaxSize\":32,\"ParallelApplyBufferSize\":0,\"ParallelApplyQueuesPerThread\":0,\"ParallelApplyThreads\":0,\"ParallelLoadBufferSize\":0,\"ParallelLoadQueuesPerThread\":0,\"ParallelLoadThreads\":0,\"SupportLobs\":true,\"TargetSchema\":\"\",\"TaskRecoveryTableEnabled\":false},\"TTSettings\":{\"EnableTT\":false,\"TTRecordSettings\":null,\"TTS3Settings\":null}}" source_endpoint_arn = aws_dms_endpoint.source.endpoint_arn table_mappings = "{\"rules\":[{\"rule-type\":\"selection\",\"rule-id\":\"1\",\"rule-name\":\"%[3]s\",\"object-locator\":{\"schema-name\":\"%%\",\"table-name\":\"%%\"},\"rule-action\":\"include\"}]}" From 59532f5235aa87fe000ee9b7f059c4046056a751 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 26 Apr 2022 16:07:33 -0400 Subject: [PATCH 12/14] r/aws_replication_task: increase waiter delay for stopping task --- internal/service/dms/replication_task_test.go | 4 ++-- internal/service/dms/wait.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index 0bde9ef8d187..42418ba90b82 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -264,7 +264,7 @@ resource "aws_dms_replication_task" "test" { migration_type = "full-load" replication_instance_arn = aws_dms_replication_instance.test.replication_instance_arn replication_task_id = %[1]q - replication_task_settings = "{\"BeforeImageSettings\":null,\"FailTaskWhenCleanTaskResourceFailed\":false,\"ChangeProcessingDdlHandlingPolicy\":{\"HandleSourceTableAltered\":true,\"HandleSourceTableDropped\":true,\"HandleSourceTableTruncated\":true},\"ChangeProcessingTuning\":{\"BatchApplyMemoryLimit\":500,\"BatchApplyPreserveTransaction\":true,\"BatchApplyTimeoutMax\":30,\"BatchApplyTimeoutMin\":1,\"BatchSplitSize\":0,\"CommitTimeout\":1,\"MemoryKeepTime\":60,\"MemoryLimitTotal\":1024,\"MinTransactionSize\":1000,\"StatementCacheSize\":50},\"CharacterSetSettings\":null,\"ControlTablesSettings\":{\"ControlSchema\":\"\",\"FullLoadExceptionTableEnabled\":false,\"HistoryTableEnabled\":false,\"HistoryTimeslotInMinutes\":5,\"StatusTableEnabled\":false,\"SuspendedTablesTableEnabled\":false},\"ErrorBehavior\":{\"ApplyErrorDeletePolicy\":\"IGNORE_RECORD\",\"ApplyErrorEscalationCount\":0,\"ApplyErrorEscalationPolicy\":\"LOG_ERROR\",\"ApplyErrorFailOnTruncationDdl\":false,\"ApplyErrorInsertPolicy\":\"LOG_ERROR\",\"ApplyErrorUpdatePolicy\":\"LOG_ERROR\",\"DataErrorEscalationCount\":0,\"DataErrorEscalationPolicy\":\"SUSPEND_TABLE\",\"DataErrorPolicy\":\"LOG_ERROR\",\"DataTruncationErrorPolicy\":\"LOG_ERROR\",\"FailOnNoTablesCaptured\":false,\"FailOnTransactionConsistencyBreached\":false,\"FullLoadIgnoreConflicts\":true,\"RecoverableErrorCount\":-1,\"RecoverableErrorInterval\":5,\"RecoverableErrorStopRetryAfterThrottlingMax\":false,\"RecoverableErrorThrottling\":true,\"RecoverableErrorThrottlingMax\":1800,\"TableErrorEscalationCount\":0,\"TableErrorEscalationPolicy\":\"STOP_TASK\",\"TableErrorPolicy\":\"SUSPEND_TABLE\"},\"FullLoadSettings\":{\"CommitRate\":10000,\"CreatePkAfterFullLoad\":false,\"MaxFullLoadSubTasks\":8,\"StopTaskCachedChangesApplied\":false,\"StopTaskCachedChangesNotApplied\":false,\"TargetTablePrepMode\":\"DROP_AND_CREATE\",\"TransactionConsistencyTimeout\":600},\"Logging\":{\"EnableLogging\":false,\"LogComponents\":[{\"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\",\"Severity\":\"LOGGER_SEVERITY_DEFAULT\"}]},\"LoopbackPreventionSettings\":null,\"PostProcessingRules\":null,\"StreamBufferSettings\":{\"CtrlStreamBufferSizeInMB\":5,\"StreamBufferCount\":3,\"StreamBufferSizeInMB\":8},\"TargetMetadata\":{\"BatchApplyEnabled\":false,\"FullLobMode\":false,\"InlineLobMaxSize\":0,\"LimitedSizeLobMode\":true,\"LoadMaxFileSize\":0,\"LobChunkSize\":0,\"LobMaxSize\":32,\"ParallelApplyBufferSize\":0,\"ParallelApplyQueuesPerThread\":0,\"ParallelApplyThreads\":0,\"ParallelLoadBufferSize\":0,\"ParallelLoadQueuesPerThread\":0,\"ParallelLoadThreads\":0,\"SupportLobs\":true,\"TargetSchema\":\"\",\"TaskRecoveryTableEnabled\":false},\"TTSettings\":{\"EnableTT\":false,\"TTRecordSettings\":null,\"TTS3Settings\":null}}" + replication_task_settings = "{\"BeforeImageSettings\":null,\"FailTaskWhenCleanTaskResourceFailed\":false,\"ChangeProcessingDdlHandlingPolicy\":{\"HandleSourceTableAltered\":true,\"HandleSourceTableDropped\":true,\"HandleSourceTableTruncated\":true},\"ChangeProcessingTuning\":{\"BatchApplyMemoryLimit\":500,\"BatchApplyPreserveTransaction\":true,\"BatchApplyTimeoutMax\":30,\"BatchApplyTimeoutMin\":1,\"BatchSplitSize\":0,\"CommitTimeout\":1,\"MemoryKeepTime\":60,\"MemoryLimitTotal\":1024,\"MinTransactionSize\":1000,\"StatementCacheSize\":50},\"CharacterSetSettings\":null,\"ControlTablesSettings\":{\"ControlSchema\":\"\",\"FullLoadExceptionTableEnabled\":false,\"HistoryTableEnabled\":false,\"HistoryTimeslotInMinutes\":5,\"StatusTableEnabled\":false,\"SuspendedTablesTableEnabled\":false},\"ErrorBehavior\":{\"ApplyErrorDeletePolicy\":\"IGNORE_RECORD\",\"ApplyErrorEscalationCount\":0,\"ApplyErrorEscalationPolicy\":\"LOG_ERROR\",\"ApplyErrorFailOnTruncationDdl\":false,\"ApplyErrorInsertPolicy\":\"LOG_ERROR\",\"ApplyErrorUpdatePolicy\":\"LOG_ERROR\",\"DataErrorEscalationCount\":0,\"DataErrorEscalationPolicy\":\"SUSPEND_TABLE\",\"DataErrorPolicy\":\"LOG_ERROR\",\"DataTruncationErrorPolicy\":\"LOG_ERROR\",\"EventErrorPolicy\":null,\"FailOnNoTablesCaptured\":false,\"FailOnTransactionConsistencyBreached\":false,\"FullLoadIgnoreConflicts\":true,\"RecoverableErrorCount\":-1,\"RecoverableErrorInterval\":5,\"RecoverableErrorStopRetryAfterThrottlingMax\":false,\"RecoverableErrorThrottling\":true,\"RecoverableErrorThrottlingMax\":1800,\"TableErrorEscalationCount\":0,\"TableErrorEscalationPolicy\":\"STOP_TASK\",\"TableErrorPolicy\":\"SUSPEND_TABLE\"},\"FullLoadSettings\":{\"CommitRate\":10000,\"CreatePkAfterFullLoad\":false,\"MaxFullLoadSubTasks\":8,\"StopTaskCachedChangesApplied\":false,\"StopTaskCachedChangesNotApplied\":false,\"TargetTablePrepMode\":\"DROP_AND_CREATE\",\"TransactionConsistencyTimeout\":600},\"Logging\":{\"EnableLogging\":false,\"LogComponents\":[{\"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\",\"Severity\":\"LOGGER_SEVERITY_DEFAULT\"}]},\"LoopbackPreventionSettings\":null,\"PostProcessingRules\":null,\"StreamBufferSettings\":{\"CtrlStreamBufferSizeInMB\":5,\"StreamBufferCount\":3,\"StreamBufferSizeInMB\":8},\"TargetMetadata\":{\"BatchApplyEnabled\":false,\"FullLobMode\":false,\"InlineLobMaxSize\":0,\"LimitedSizeLobMode\":true,\"LoadMaxFileSize\":0,\"LobChunkSize\":0,\"LobMaxSize\":32,\"ParallelApplyBufferSize\":0,\"ParallelApplyQueuesPerThread\":0,\"ParallelApplyThreads\":0,\"ParallelLoadBufferSize\":0,\"ParallelLoadQueuesPerThread\":0,\"ParallelLoadThreads\":0,\"SupportLobs\":true,\"TargetSchema\":\"\",\"TaskRecoveryTableEnabled\":false},\"TTSettings\":{\"EnableTT\":false,\"TTRecordSettings\":null,\"TTS3Settings\":null}}" source_endpoint_arn = aws_dms_endpoint.source.endpoint_arn table_mappings = "{\"rules\":[{\"rule-type\":\"selection\",\"rule-id\":\"1\",\"rule-name\":\"1\",\"object-locator\":{\"schema-name\":\"%%\",\"table-name\":\"%%\"},\"rule-action\":\"include\"}]}" @@ -287,7 +287,7 @@ resource "aws_dms_replication_task" "test" { migration_type = "cdc" replication_instance_arn = aws_dms_replication_instance.test.replication_instance_arn replication_task_id = %[2]q - replication_task_settings = "{\"BeforeImageSettings\":null,\"FailTaskWhenCleanTaskResourceFailed\":false,\"ChangeProcessingDdlHandlingPolicy\":{\"HandleSourceTableAltered\":true,\"HandleSourceTableDropped\":true,\"HandleSourceTableTruncated\":true},\"ChangeProcessingTuning\":{\"BatchApplyMemoryLimit\":500,\"BatchApplyPreserveTransaction\":true,\"BatchApplyTimeoutMax\":30,\"BatchApplyTimeoutMin\":1,\"BatchSplitSize\":0,\"CommitTimeout\":1,\"MemoryKeepTime\":60,\"MemoryLimitTotal\":1024,\"MinTransactionSize\":1000,\"StatementCacheSize\":50},\"CharacterSetSettings\":null,\"ControlTablesSettings\":{\"ControlSchema\":\"\",\"FullLoadExceptionTableEnabled\":false,\"HistoryTableEnabled\":false,\"HistoryTimeslotInMinutes\":5,\"StatusTableEnabled\":false,\"SuspendedTablesTableEnabled\":false},\"ErrorBehavior\":{\"ApplyErrorDeletePolicy\":\"IGNORE_RECORD\",\"ApplyErrorEscalationCount\":0,\"ApplyErrorEscalationPolicy\":\"LOG_ERROR\",\"ApplyErrorFailOnTruncationDdl\":false,\"ApplyErrorInsertPolicy\":\"LOG_ERROR\",\"ApplyErrorUpdatePolicy\":\"LOG_ERROR\",\"DataErrorEscalationCount\":0,\"DataErrorEscalationPolicy\":\"SUSPEND_TABLE\",\"DataErrorPolicy\":\"LOG_ERROR\",\"DataTruncationErrorPolicy\":\"LOG_ERROR\",\"FailOnNoTablesCaptured\":false,\"FailOnTransactionConsistencyBreached\":false,\"FullLoadIgnoreConflicts\":true,\"RecoverableErrorCount\":-1,\"RecoverableErrorInterval\":5,\"RecoverableErrorStopRetryAfterThrottlingMax\":false,\"RecoverableErrorThrottling\":true,\"RecoverableErrorThrottlingMax\":1800,\"TableErrorEscalationCount\":0,\"TableErrorEscalationPolicy\":\"STOP_TASK\",\"TableErrorPolicy\":\"SUSPEND_TABLE\"},\"FullLoadSettings\":{\"CommitRate\":10000,\"CreatePkAfterFullLoad\":false,\"MaxFullLoadSubTasks\":8,\"StopTaskCachedChangesApplied\":false,\"StopTaskCachedChangesNotApplied\":false,\"TargetTablePrepMode\":\"DROP_AND_CREATE\",\"TransactionConsistencyTimeout\":600},\"Logging\":{\"EnableLogging\":false,\"LogComponents\":[{\"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\",\"Severity\":\"LOGGER_SEVERITY_DEFAULT\"}]},\"LoopbackPreventionSettings\":null,\"PostProcessingRules\":null,\"StreamBufferSettings\":{\"CtrlStreamBufferSizeInMB\":5,\"StreamBufferCount\":3,\"StreamBufferSizeInMB\":8},\"TargetMetadata\":{\"BatchApplyEnabled\":false,\"FullLobMode\":false,\"InlineLobMaxSize\":0,\"LimitedSizeLobMode\":true,\"LoadMaxFileSize\":0,\"LobChunkSize\":0,\"LobMaxSize\":32,\"ParallelApplyBufferSize\":0,\"ParallelApplyQueuesPerThread\":0,\"ParallelApplyThreads\":0,\"ParallelLoadBufferSize\":0,\"ParallelLoadQueuesPerThread\":0,\"ParallelLoadThreads\":0,\"SupportLobs\":true,\"TargetSchema\":\"\",\"TaskRecoveryTableEnabled\":false},\"TTSettings\":{\"EnableTT\":false,\"TTRecordSettings\":null,\"TTS3Settings\":null}}" + replication_task_settings = "{\"BeforeImageSettings\":null,\"FailTaskWhenCleanTaskResourceFailed\":false,\"ChangeProcessingDdlHandlingPolicy\":{\"HandleSourceTableAltered\":true,\"HandleSourceTableDropped\":true,\"HandleSourceTableTruncated\":true},\"ChangeProcessingTuning\":{\"BatchApplyMemoryLimit\":500,\"BatchApplyPreserveTransaction\":true,\"BatchApplyTimeoutMax\":30,\"BatchApplyTimeoutMin\":1,\"BatchSplitSize\":0,\"CommitTimeout\":1,\"MemoryKeepTime\":60,\"MemoryLimitTotal\":1024,\"MinTransactionSize\":1000,\"StatementCacheSize\":50},\"CharacterSetSettings\":null,\"ControlTablesSettings\":{\"ControlSchema\":\"\",\"FullLoadExceptionTableEnabled\":false,\"HistoryTableEnabled\":false,\"HistoryTimeslotInMinutes\":5,\"StatusTableEnabled\":false,\"SuspendedTablesTableEnabled\":false},\"ErrorBehavior\":{\"ApplyErrorDeletePolicy\":\"IGNORE_RECORD\",\"ApplyErrorEscalationCount\":0,\"ApplyErrorEscalationPolicy\":\"LOG_ERROR\",\"ApplyErrorFailOnTruncationDdl\":false,\"ApplyErrorInsertPolicy\":\"LOG_ERROR\",\"ApplyErrorUpdatePolicy\":\"LOG_ERROR\",\"DataErrorEscalationCount\":0,\"DataErrorEscalationPolicy\":\"SUSPEND_TABLE\",\"DataErrorPolicy\":\"LOG_ERROR\",\"DataTruncationErrorPolicy\":\"LOG_ERROR\",\"EventErrorPolicy\":null,\"FailOnNoTablesCaptured\":false,\"FailOnTransactionConsistencyBreached\":false,\"FullLoadIgnoreConflicts\":true,\"RecoverableErrorCount\":-1,\"RecoverableErrorInterval\":5,\"RecoverableErrorStopRetryAfterThrottlingMax\":false,\"RecoverableErrorThrottling\":true,\"RecoverableErrorThrottlingMax\":1800,\"TableErrorEscalationCount\":0,\"TableErrorEscalationPolicy\":\"STOP_TASK\",\"TableErrorPolicy\":\"SUSPEND_TABLE\"},\"FullLoadSettings\":{\"CommitRate\":10000,\"CreatePkAfterFullLoad\":false,\"MaxFullLoadSubTasks\":8,\"StopTaskCachedChangesApplied\":false,\"StopTaskCachedChangesNotApplied\":false,\"TargetTablePrepMode\":\"DROP_AND_CREATE\",\"TransactionConsistencyTimeout\":600},\"Logging\":{\"EnableLogging\":false,\"LogComponents\":[{\"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\",\"Severity\":\"LOGGER_SEVERITY_DEFAULT\"}]},\"LoopbackPreventionSettings\":null,\"PostProcessingRules\":null,\"StreamBufferSettings\":{\"CtrlStreamBufferSizeInMB\":5,\"StreamBufferCount\":3,\"StreamBufferSizeInMB\":8},\"TargetMetadata\":{\"BatchApplyEnabled\":false,\"FullLobMode\":false,\"InlineLobMaxSize\":0,\"LimitedSizeLobMode\":true,\"LoadMaxFileSize\":0,\"LobChunkSize\":0,\"LobMaxSize\":32,\"ParallelApplyBufferSize\":0,\"ParallelApplyQueuesPerThread\":0,\"ParallelApplyThreads\":0,\"ParallelLoadBufferSize\":0,\"ParallelLoadQueuesPerThread\":0,\"ParallelLoadThreads\":0,\"SupportLobs\":true,\"TargetSchema\":\"\",\"TaskRecoveryTableEnabled\":false},\"TTSettings\":{\"EnableTT\":false,\"TTRecordSettings\":null,\"TTS3Settings\":null}}" source_endpoint_arn = aws_dms_endpoint.source.endpoint_arn table_mappings = "{\"rules\":[{\"rule-type\":\"selection\",\"rule-id\":\"1\",\"rule-name\":\"1\",\"object-locator\":{\"schema-name\":\"%%\",\"table-name\":\"%%\"},\"rule-action\":\"include\"}]}" target_endpoint_arn = aws_dms_endpoint.target.endpoint_arn diff --git a/internal/service/dms/wait.go b/internal/service/dms/wait.go index 0f3c6a0c100d..23cf5d7fe608 100644 --- a/internal/service/dms/wait.go +++ b/internal/service/dms/wait.go @@ -100,7 +100,7 @@ func waitReplicationTaskStopped(conn *dms.DatabaseMigrationService, id string) e Refresh: statusReplicationTask(conn, id), Timeout: replicationTaskRunningTimeout, MinTimeout: 10 * time.Second, - Delay: 30 * time.Second, // Wait 30 secs before starting + Delay: 60 * time.Second, // Wait 30 secs before starting } // Wait, catching any errors From ee1c669d49d57f54572c38334e391f58edfde444 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 26 Apr 2022 16:16:09 -0400 Subject: [PATCH 13/14] update release note --- .changelog/24047.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/24047.txt b/.changelog/24047.txt index e7befef2a4e8..ce3d1c63050c 100644 --- a/.changelog/24047.txt +++ b/.changelog/24047.txt @@ -1,3 +1,3 @@ ```release-note:bug -resource/aws_dms_replication_task: Fix: The task is now stopped before updating it, if required. +resource/aws_dms_replication_task: Fix to stop the task before updating, if required ``` From 824cb0ca0185b1223b09e84b8ab23a7a6602aa9b Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Tue, 26 Apr 2022 17:04:44 -0400 Subject: [PATCH 14/14] r/aws_replication_task: add _disappears test --- internal/service/dms/replication_task_test.go | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index 42418ba90b82..9f03af574f36 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/tfresource" ) -func TestAccDMSReplicationTask_basic(t *testing.T) { +func TestAccReplicationTask_basic(t *testing.T) { rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_dms_replication_task.test" @@ -61,7 +61,7 @@ func TestAccDMSReplicationTask_basic(t *testing.T) { }) } -func TestAccDMSReplicationTask_cdcStartPosition(t *testing.T) { +func TestAccReplicationTask_cdcStartPosition(t *testing.T) { rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_dms_replication_task.test" @@ -88,7 +88,7 @@ func TestAccDMSReplicationTask_cdcStartPosition(t *testing.T) { }) } -func TestAccDMSReplicationTask_startReplicationTask(t *testing.T) { +func TestAccReplicationTask_startReplicationTask(t *testing.T) { if testing.Short() { t.Skip("skipping long-running test in short mode") } @@ -133,6 +133,32 @@ func TestAccDMSReplicationTask_startReplicationTask(t *testing.T) { }) } +func TestAccReplicationTask_disappears(t *testing.T) { + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_dms_replication_task.test" + + tags := ` + Test = "test" +` + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ErrorCheck: acctest.ErrorCheck(t, dms.EndpointsID), + Providers: acctest.Providers, + CheckDestroy: testAccCheckReplicationTaskDestroy, + Steps: []resource.TestStep{ + { + Config: dmsReplicationTaskConfig(rName, tags), + Check: resource.ComposeTestCheckFunc( + testAccCheckReplicationTaskExists(resourceName), + acctest.CheckResourceDisappears(acctest.Provider, tfdms.ResourceReplicationTask(), resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + func testAccCheckReplicationTaskExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n]