Skip to content

Commit 6b93437

Browse files
feat: Add VPC Endpoint for SES (#449)
1 parent 064d577 commit 6b93437

File tree

4 files changed

+71
-1
lines changed

4 files changed

+71
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ These types of resources are supported:
2020
* [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):
2121
* Gateway: S3, DynamoDB
2222
* Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,
23-
ECS, ECS Agent, ECS Telemetry, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),
23+
ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),
2424
Elastic Load Balancing, CloudTrail, Secrets Manager, Config, CodeBuild, CodeCommit,
2525
Git-Codecommit, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),
2626
CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream,
@@ -397,6 +397,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
397397
| enable\_sagemaker\_runtime\_endpoint | Should be true if you want to provision a SageMaker Runtime endpoint to the VPC | `bool` | `false` | no |
398398
| enable\_secretsmanager\_endpoint | Should be true if you want to provision an Secrets Manager endpoint to the VPC | `bool` | `false` | no |
399399
| enable\_servicecatalog\_endpoint | Should be true if you want to provision a Service Catalog endpoint to the VPC | `bool` | `false` | no |
400+
| enable\_ses\_endpoint | Should be true if you want to provision an SES endpoint to the VPC | `bool` | `false` | no |
400401
| enable\_sns\_endpoint | Should be true if you want to provision a SNS endpoint to the VPC | `bool` | `false` | no |
401402
| enable\_sqs\_endpoint | Should be true if you want to provision an SQS endpoint to the VPC | `bool` | `false` | no |
402403
| enable\_ssm\_endpoint | Should be true if you want to provision an SSM endpoint to the VPC | `bool` | `false` | no |
@@ -513,6 +514,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
513514
| servicecatalog\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Service Catalog endpoint | `bool` | `false` | no |
514515
| servicecatalog\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Service Catalog endpoint | `list(string)` | `[]` | no |
515516
| servicecatalog\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Service Catalog endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |
517+
| ses\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SES endpoint | `bool` | `false` | no |
518+
| ses\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for SES endpoint | `list(string)` | `[]` | no |
519+
| ses\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for SES endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |
516520
| single\_nat\_gateway | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |
517521
| sns\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SNS endpoint | `bool` | `false` | no |
518522
| sns\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for SNS endpoint | `list(string)` | `[]` | no |
@@ -736,6 +740,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
736740
| vpc\_endpoint\_servicecatalog\_dns\_entry | The DNS entries for the VPC Endpoint for Service Catalog. |
737741
| vpc\_endpoint\_servicecatalog\_id | The ID of VPC endpoint for Service Catalog |
738742
| vpc\_endpoint\_servicecatalog\_network\_interface\_ids | One or more network interfaces for the VPC Endpoint for Service Catalog. |
743+
| vpc\_endpoint\_ses\_dns\_entry | The DNS entries for the VPC Endpoint for SES. |
744+
| vpc\_endpoint\_ses\_id | The ID of VPC endpoint for SES |
745+
| vpc\_endpoint\_ses\_network\_interface\_ids | One or more network interfaces for the VPC Endpoint for SES. |
739746
| vpc\_endpoint\_sns\_dns\_entry | The DNS entries for the VPC Endpoint for SNS. |
740747
| vpc\_endpoint\_sns\_id | The ID of VPC endpoint for SNS |
741748
| vpc\_endpoint\_sns\_network\_interface\_ids | One or more network interfaces for the VPC Endpoint for SNS. |

outputs.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,22 @@ output "vpc_endpoint_cloud_directory_dns_entry" {
10871087
value = flatten(aws_vpc_endpoint.cloud_directory.*.dns_entry)
10881088
}
10891089

1090+
output "vpc_endpoint_ses_id" {
1091+
description = "The ID of VPC endpoint for SES"
1092+
value = concat(aws_vpc_endpoint.ses.*.id, [""])[0]
1093+
}
1094+
1095+
output "vpc_endpoint_ses_network_interface_ids" {
1096+
description = "One or more network interfaces for the VPC Endpoint for SES."
1097+
value = flatten(aws_vpc_endpoint.ses.*.network_interface_ids)
1098+
}
1099+
1100+
output "vpc_endpoint_ses_dns_entry" {
1101+
description = "The DNS entries for the VPC Endpoint for SES."
1102+
value = flatten(aws_vpc_endpoint.ses.*.dns_entry)
1103+
}
1104+
1105+
10901106
# VPC flow log
10911107
output "vpc_flow_log_id" {
10921108
description = "The ID of the Flow Log resource"

variables.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,30 @@ variable "cloud_directory_endpoint_private_dns_enabled" {
13231323
default = false
13241324
}
13251325

1326+
variable "enable_ses_endpoint" {
1327+
description = "Should be true if you want to provision an SES endpoint to the VPC"
1328+
type = bool
1329+
default = false
1330+
}
1331+
1332+
variable "ses_endpoint_security_group_ids" {
1333+
description = "The ID of one or more security groups to associate with the network interface for SES endpoint"
1334+
type = list(string)
1335+
default = []
1336+
}
1337+
1338+
variable "ses_endpoint_subnet_ids" {
1339+
description = "The ID of one or more subnets in which to create a network interface for SES endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used."
1340+
type = list(string)
1341+
default = []
1342+
}
1343+
1344+
variable "ses_endpoint_private_dns_enabled" {
1345+
description = "Whether or not to associate a private hosted zone with the specified VPC for SES endpoint"
1346+
type = bool
1347+
default = false
1348+
}
1349+
13261350

13271351
variable "map_public_ip_on_launch" {
13281352
description = "Should be false if you do not want to auto-assign public IP on launch"

vpc-endpoints.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,3 +1026,26 @@ resource "aws_vpc_endpoint" "cloud_directory" {
10261026

10271027
tags = local.vpce_tags
10281028
}
1029+
1030+
#######################
1031+
# VPC Endpoint for SES
1032+
#######################
1033+
data "aws_vpc_endpoint_service" "ses" {
1034+
count = var.create_vpc && var.enable_ses_endpoint ? 1 : 0
1035+
1036+
service = "email-smtp"
1037+
}
1038+
1039+
resource "aws_vpc_endpoint" "ses" {
1040+
count = var.create_vpc && var.enable_ses_endpoint ? 1 : 0
1041+
1042+
vpc_id = local.vpc_id
1043+
service_name = data.aws_vpc_endpoint_service.ses[0].service_name
1044+
vpc_endpoint_type = "Interface"
1045+
1046+
security_group_ids = var.ses_endpoint_security_group_ids
1047+
subnet_ids = coalescelist(var.ses_endpoint_subnet_ids, aws_subnet.private.*.id)
1048+
private_dns_enabled = var.ses_endpoint_private_dns_enabled
1049+
1050+
tags = local.vpce_tags
1051+
}

0 commit comments

Comments
 (0)