$ terraform -v
Terraform v0.11.7
+ provider.aws v1.19.0
+ provider.template v1.0.0
data "aws_kms_alias" "dms" {
name = "alias/aws/dms"
}
resource "aws_dms_endpoint" "my-endpoint" {
endpoint_id = "my-endpoint"
endpoint_type = "source"
engine_name = "mongodb"
server_name = "${var.host}"
port = "${var.port}"
username = "${var.username}"
password = "${var.password}"
database_name = "my-db"
ssl_mode = "require"
kms_key_arn = "${data.aws_kms_alias.dms.target_key_arn}"
mongodb_settings {
auth_type = "PASSWORD"
auth_mechanism = "DEFAULT"
nesting_level = "NONE"
extract_doc_id = "true"
auth_source = "admin"
}
tags {
Terraform = "true"
Environment = "${terraform.workspace}"
}
}
aws dms test-connection --replication-instance-arn <replication_instance_arn> --endpoint-arn <endpoint_arn> tests the source database connection correctly. Passes if the connection info are correct.
aws dms test-connection --replication-instance-arn <replication_instance_arn> --endpoint-arn <endpoint_arn> fails with the following error message
There was a problem with the request: DatabaseName is required for MongoDB
even though DatabaseName is correctly specified under MongoDbSettings. Checked against the output of aws dms describe-endpoints | jq '.Endpoints[] | select(.EndpointIdentifier=="my-endpoint")'
{
"EndpointIdentifier": "my-endpoint",
"EndpointType": "SOURCE",
"EngineName": "mongodb",
"EngineDisplayName": "MongoDB",
"ExtraConnectionAttributes": "<computed>",
"Status": "active",
"KmsKeyId": "<kms_key_id>",
"EndpointArn": "<computed>",
"SslMode": "require",
"MongoDbSettings": {
"Username": "<username>",
"ServerName": "<server_name>",
"Port": <port>,
"DatabaseName": "my-db",
"AuthType": "PASSWORD",
"AuthMechanism": "DEFAULT",
"NestingLevel": "NONE",
"ExtractDocId": "true",
"DocsToInvestigate": "1000",
"AuthSource": "admin",
"KmsKeyId": "<kms_key_id>"
}
}
(Note: The MongoDbSettings.DatabaseName field is present but DatabaseName is missing at the root level above.)
Looks like DatabaseName needs to be present at the root level as well. I am not certain if that's the case with the rest of the connection info; Username, Password, ServerName and Port.
Thanks @microamp! The fix for this (#4636) will release with v1.21.0 of the AWS provider, likely middle of next week.
This has been released in version 1.21.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
Thanks @microamp! The fix for this (#4636) will release with v1.21.0 of the AWS provider, likely middle of next week.