terraform-aws-modules / terraform-aws-dms

Terraform module to create AWS DMS (Database Migration Service) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/dms/aws
Apache License 2.0
60 stars 93 forks source link

Creating AWS DMS task fails with: InvalidParameterValueException: TimestampColumnName cannot be an empty string. #24

Closed casey-robertson-paypal closed 1 year ago

casey-robertson-paypal commented 1 year ago

Description

Module will not build a DMS task without passing a non-empty value for timestamp_column_name in the associated endpoint. You can CREATE the endpoints by themselves without this value. The error arises when creating DMS replication tasks.

Versions

Reproduction Code [Required]

// S3 endpoint target definition
    s3-target-main-ongoing-csv = {
      endpoint_id   = "hr-pypl-s3-target-${var.environment}-ongoing-csv"
      endpoint_type = "target"
      engine_name   = "s3"
      ssl_mode      = "none"

      s3_settings = {
        bucket_folder             = "ongoing-csv"
        bucket_name               = local.bucket_name # to avoid https://github.com/hashicorp/terraform/issues/4149
        data_format               = "csv"
        encryption_mode           = "SSE_S3"
        // external_table_definition = file("configs/s3_table_definition.json")
        service_access_role_arn   = "arn:${data.aws_partition.current.partition}:iam::${data.aws_caller_identity.current.account_id}:role/${local.name}-s3" # to avoid https://github.com/hashicorp/terraform/issues/4149
      }

       tags                        =  merge(tomap({ EndpointType = "source" }), local.tags)
    }

// Task definition
postgres-db-main-ongoing-a-csv = {
      replication_task_id       = "hr-pypl-edl-${local.name}-db-main-ongoing-a-csv"
      migration_type            = "cdc"
      replication_task_settings = file("./dms_config/task_settings/task-settings-ongoing.json")
      table_mappings            = file("./dms_config/table_mappings/table-mappings-ongoing-a.json")
      source_endpoint_key       = "postgresql-source-db-main"
      target_endpoint_key       = "s3-target-main-ongoing-csv"
      tags                        =  merge(tomap({ Task = "Dev-DB-CDC-to-S3" }), local.tags)
    }

Steps to reproduce the behavior:

Invoke the module leveraging a bucket and role that was created. This worked earlier today - came back to make some changes to the endpoint configs and on subsequent runs it fails now. Settings above are pre-change - exactly as earlier when the replication tasks successfully created.

Expected behavior

DMS replication task created that leverages the above S3 target endpoint

Actual behavior

AWS API throws an error about empty config value

Terminal Output Screenshot(s)

Error: error creating DMS Replication Task (hr-pypl-edl-dms-dev-db-main-ongoing-a-csv): InvalidParameterValueException: TimestampColumnName cannot be an empty string.
│       status code: 400, request id: 0428df1b-f6da-46f1-96da-6aea1182b7d6
│ 
│   with module.database_migration_service.aws_dms_replication_task.this["postgres-db-main-ongoing-a-csv"],
│   on .terraform/modules/database_migration_service/main.tf line 289, in resource "aws_dms_replication_task" "this":
│  289: resource "aws_dms_replication_task" "this" {

Additional context

Yesterday and today this module, endpoints (source and target S3) and jobs created without issue. Now it only runs if I supply what should be an optional timestamp_column_name config value per this documentation: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/dms_endpoint#timestamp_column_name

If I add a value such as timestamp_column_name = "foo" to the S3 endpoint configuration, the plan and apply run without issue. But per the Terraform and API docs this should be an optional value. I'm at a loss.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] commented 1 year ago

This issue was automatically closed because of stale in 10 days

skolsuper commented 1 year ago

Closed without acknowledgement, what an annoying bot

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.