Skip to content

Commit 5446e1c

Browse files
authored
feat: Adding VPC endpoint for DMS (#564)
1 parent 0ea6ffa commit 5446e1c

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, Sa
2626
CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream API, AppStream Streaming,
2727
Athena, Rekognition, Elastic File System (EFS), Cloud Directory, Elastic Beanstalk (+ Health), Elastic Map Reduce(EMR),
2828
DataSync, EBS, SMS, Elastic Inference Runtime, QLDB Session, Step Functions, Access Analyzer, Auto Scaling Plans,
29-
Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure
29+
Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure, DMS
3030

3131
* [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)
3232
* [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)
@@ -350,6 +350,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
350350
| dhcp\_options\_netbios\_node\_type | Specify netbios node\_type for DHCP options set (requires enable\_dhcp\_options set to true) | `string` | `""` | no |
351351
| dhcp\_options\_ntp\_servers | Specify a list of NTP servers for DHCP options set (requires enable\_dhcp\_options set to true) | `list(string)` | `[]` | no |
352352
| dhcp\_options\_tags | Additional tags for the DHCP option set (requires enable\_dhcp\_options set to true) | `map(string)` | `{}` | no |
353+
| dms\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |
354+
| dms\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |
355+
| dms\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |
353356
| ebs\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |
354357
| ebs\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |
355358
| ebs\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |
@@ -428,6 +431,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
428431
| enable\_config\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |
429432
| enable\_datasync\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |
430433
| enable\_dhcp\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |
434+
| enable\_dms\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |
431435
| enable\_dns\_hostnames | Should be true to enable DNS hostnames in the VPC | `bool` | `false` | no |
432436
| enable\_dns\_support | Should be true to enable DNS support in the VPC | `bool` | `true` | no |
433437
| enable\_dynamodb\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | `bool` | `false` | no |
@@ -799,6 +803,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
799803
| vpc\_endpoint\_datasync\_dns\_entry | The DNS entries for the VPC Endpoint for DataSync. |
800804
| vpc\_endpoint\_datasync\_id | The ID of VPC endpoint for DataSync |
801805
| vpc\_endpoint\_datasync\_network\_interface\_ids | One or more network interfaces for the VPC Endpoint for DataSync. |
806+
| vpc\_endpoint\_dms\_dns\_entry | The DNS entries for the VPC Endpoint for DMS. |
807+
| vpc\_endpoint\_dms\_id | The ID of VPC endpoint for DMS |
808+
| vpc\_endpoint\_dms\_network\_interface\_ids | One or more network interfaces for the VPC Endpoint for DMS. |
802809
| vpc\_endpoint\_dynamodb\_id | The ID of VPC endpoint for DynamoDB |
803810
| vpc\_endpoint\_dynamodb\_pl\_id | The prefix list for the DynamoDB VPC endpoint. |
804811
| vpc\_endpoint\_ebs\_dns\_entry | The DNS entries for the VPC Endpoint for EBS. |

outputs.tf

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,21 @@ output "vpc_endpoint_codeartifact_repositories_dns_entry" {
14071407
value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)
14081408
}
14091409

1410+
output "vpc_endpoint_dms_id" {
1411+
description = "The ID of VPC endpoint for DMS"
1412+
value = concat(aws_vpc_endpoint.sns.*.id, [""])[0]
1413+
}
1414+
1415+
output "vpc_endpoint_dms_network_interface_ids" {
1416+
description = "One or more network interfaces for the VPC Endpoint for DMS."
1417+
value = flatten(aws_vpc_endpoint.sns.*.network_interface_ids)
1418+
}
1419+
1420+
output "vpc_endpoint_dms_dns_entry" {
1421+
description = "The DNS entries for the VPC Endpoint for DMS."
1422+
value = flatten(aws_vpc_endpoint.sns.*.dns_entry)
1423+
}
1424+
14101425
output "vpc_endpoint_rds_id" {
14111426
description = "The ID of VPC endpoint for RDS"
14121427
value = concat(aws_vpc_endpoint.rds.*.id, [""])[0]
@@ -1422,7 +1437,6 @@ output "vpc_endpoint_rds_dns_entry" {
14221437
value = flatten(aws_vpc_endpoint.rds.*.dns_entry)
14231438
}
14241439

1425-
14261440
# VPC flow log
14271441
output "vpc_flow_log_id" {
14281442
description = "The ID of the Flow Log resource"

variables.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,30 @@ variable "acm_pca_endpoint_private_dns_enabled" {
18831883
default = false
18841884
}
18851885

1886+
variable "enable_dms_endpoint" {
1887+
description = "Should be true if you want to provision a DMS endpoint to the VPC"
1888+
type = bool
1889+
default = false
1890+
}
1891+
1892+
variable "dms_endpoint_security_group_ids" {
1893+
description = "The ID of one or more security groups to associate with the network interface for DMS endpoint"
1894+
type = list(string)
1895+
default = []
1896+
}
1897+
1898+
variable "dms_endpoint_subnet_ids" {
1899+
description = "The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used."
1900+
type = list(string)
1901+
default = []
1902+
}
1903+
1904+
variable "dms_endpoint_private_dns_enabled" {
1905+
description = "Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint"
1906+
type = bool
1907+
default = false
1908+
}
1909+
18861910
variable "map_public_ip_on_launch" {
18871911
description = "Should be false if you do not want to auto-assign public IP on launch"
18881912
type = bool

vpc-endpoints.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,3 +1529,27 @@ resource "aws_vpc_endpoint" "codeartifact_repositories" {
15291529

15301530
tags = local.vpce_tags
15311531
}
1532+
1533+
1534+
#############################################
1535+
# VPC Endpoint for Database Migration Service
1536+
#############################################
1537+
data "aws_vpc_endpoint_service" "dms" {
1538+
count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0
1539+
1540+
service = "dms"
1541+
}
1542+
1543+
resource "aws_vpc_endpoint" "dms" {
1544+
count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0
1545+
1546+
vpc_id = local.vpc_id
1547+
service_name = data.aws_vpc_endpoint_service.dms[0].service_name
1548+
vpc_endpoint_type = "Interface"
1549+
1550+
security_group_ids = var.dms_endpoint_security_group_ids
1551+
subnet_ids = coalescelist(var.dms_endpoint_subnet_ids, aws_subnet.private.*.id)
1552+
private_dns_enabled = var.dms_endpoint_private_dns_enabled
1553+
1554+
tags = local.vpce_tags
1555+
}

0 commit comments

Comments
 (0)