hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.76k stars 9.12k forks source link

[Enhancement]: Add DNS Name Servers for AWS Database Migration Service (DMS) Replication Instance Resource #37684

Closed casperfrx closed 4 months ago

casperfrx commented 4 months ago

Description

Replication Instances by default use Amazon-provided DNS for resolutions. However you can specificy custom DNS servers to the instance as well. See this Knowledge Center post: https://repost.aws/knowledge-center/dms-endpoint-connectivity-failures

The AWS CLI documentation also mentions this option: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dms/create-replication-instance.html

Specifically:

--dns-name-servers (string)

A list of custom DNS name servers supported for the replication instance to access your on-premise source or target database. This list overrides the default name servers supported by the replication instance. You can specify a comma-separated list of internet addresses for up to four on-premise DNS name servers. For example: "1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4"

As does the API Reference: https://docs.aws.amazon.com/dms/latest/APIReference/API_CreateReplicationInstance.html#DMS-CreateReplicationInstance-request-DnsNameServers

I've tested this CLI option and it works as expected. Custom DNS servers can be configured to a replication instance and they can then resolve DNS queries without the use of any extra AWS DNS service like Route53 Resolver to forward the DNS queries.

The Key/Value of the JSON returned by aws dms describe-replication-instances is { ..., "DnsNameServers": "1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4", ... }.

Terraform does not yet provide this option. Kindly requesting to add as it would be a great feature to have.

Affected Resource(s) and/or Data Source(s)

aws_dms_replication_instance

Potential Terraform Configuration

resource "aws_dms_replication_instance" "test" {
  allocated_storage            = 20
  apply_immediately            = true
  auto_minor_version_upgrade   = true
  availability_zone            = "us-west-2c"
  engine_version               = "3.1.4"
  kms_key_arn                  = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
  multi_az                     = false
  preferred_maintenance_window = "sun:10:30-sun:14:30"
  publicly_accessible          = true
  replication_instance_class   = "dms.t2.micro"
  replication_instance_id      = "test-dms-replication-instance-tf"
  replication_subnet_group_id  = aws_dms_replication_subnet_group.test-dms-replication-subnet-group-tf.id
  dns_name_servers             = "1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4"

  tags = {
    Name = "test"
  }

  vpc_security_group_ids = [
    "sg-12345678",
  ]

  depends_on = [
    aws_iam_role_policy_attachment.dms-access-for-endpoint-AmazonDMSRedshiftS3Role,
    aws_iam_role_policy_attachment.dms-cloudwatch-logs-role-AmazonDMSCloudWatchLogsRole,
    aws_iam_role_policy_attachment.dms-vpc-role-AmazonDMSVPCManagementRole
  ]
}

References

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dms/create-replication-instance.html

https://repost.aws/knowledge-center/dms-endpoint-connectivity-failures

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dms/describe-replication-instances.html

https://docs.aws.amazon.com/dms/latest/APIReference/API_CreateReplicationInstance.html

Would you like to implement a fix?

None

github-actions[bot] commented 4 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 4 months ago

Hey @casperfrx 👋 Thanks for taking the time to submit this issue. It looks like this is a duplicate of #35914. We like to try to keep discussions consolidated, so we’re going to close this new issue in favor of that one.

justinretzolk commented 4 months ago

Duplicate of #35914

github-actions[bot] commented 4 months ago

[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

github-actions[bot] commented 3 months 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.