Skip to content

Commit 25b8ae2

Browse files
authored
feat: Added Textract vpc endpoint (#509)
1 parent ca187c4 commit 25b8ae2

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ These types of resources are supported:
2222
* Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,
2323
ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),
2424
Elastic Load Balancing, CloudTrail, Secrets Manager, Config, CodeBuild, CodeCommit,
25-
Git-Codecommit, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),
25+
Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),
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,
@@ -465,6 +465,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
465465
| enable\_states\_endpoint | Should be true if you want to provision a Step Function endpoint to the VPC | `bool` | `false` | no |
466466
| enable\_storagegateway\_endpoint | Should be true if you want to provision a Storage Gateway endpoint to the VPC | `bool` | `false` | no |
467467
| enable\_sts\_endpoint | Should be true if you want to provision a STS endpoint to the VPC | `bool` | `false` | no |
468+
| enable\_textract\_endpoint | Should be true if you want to provision a Textract endpoint to the VPC | `bool` | `false` | no |
468469
| enable\_transfer\_endpoint | Should be true if you want to provision a Transfer endpoint to the VPC | `bool` | `false` | no |
469470
| enable\_transferserver\_endpoint | Should be true if you want to provision a Transfer Server endpoint to the VPC | `bool` | `false` | no |
470471
| enable\_vpn\_gateway | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |
@@ -614,9 +615,12 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
614615
| sts\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for STS endpoint | `list(string)` | `[]` | no |
615616
| sts\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for STS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |
616617
| tags | A map of tags to add to all resources | `map(string)` | `{}` | no |
618+
| textract\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Textract | `bool` | `false` | no |
619+
| textract\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Textract endpoint | `list(string)` | `[]` | no |
620+
| textract\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Textract endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |
617621
| transfer\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Transfer endpoint | `bool` | `false` | no |
618622
| transfer\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Transfer endpoint | `list(string)` | `[]` | no |
619-
| transfer\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Transfer endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |
623+
| transfer\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Transfer endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |
620624
| transferserver\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Transfer Server endpoint | `bool` | `false` | no |
621625
| transferserver\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Transfer Server endpoint | `list(string)` | `[]` | no |
622626
| transferserver\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Transfer Server endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |
@@ -890,6 +894,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
890894
| vpc\_endpoint\_sts\_dns\_entry | The DNS entries for the VPC Endpoint for STS. |
891895
| vpc\_endpoint\_sts\_id | The ID of VPC endpoint for STS |
892896
| vpc\_endpoint\_sts\_network\_interface\_ids | One or more network interfaces for the VPC Endpoint for STS. |
897+
| vpc\_endpoint\_textract\_dns\_entry | The DNS entries for the VPC Endpoint for textract. |
898+
| vpc\_endpoint\_textract\_id | The ID of VPC endpoint for textract. |
899+
| vpc\_endpoint\_textract\_network\_interface\_ids | One or more network interfaces for the VPC Endpoint for textract. |
893900
| vpc\_endpoint\_transfer\_dns\_entry | The DNS entries for the VPC Endpoint for Transfer. |
894901
| vpc\_endpoint\_transfer\_id | The ID of VPC endpoint for Transfer |
895902
| vpc\_endpoint\_transfer\_network\_interface\_ids | One or more network interfaces for the VPC Endpoint for Transfer. |

outputs.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,21 @@ output "vpc_endpoint_ses_dns_entry" {
13471347
value = flatten(aws_vpc_endpoint.ses.*.dns_entry)
13481348
}
13491349

1350+
output "vpc_endpoint_textract_id" {
1351+
description = "The ID of VPC endpoint for Textract"
1352+
value = concat(aws_vpc_endpoint.textract.*.id, [""])[0]
1353+
}
1354+
1355+
output "vpc_endpoint_textract_network_interface_ids" {
1356+
description = "One or more network interfaces for the VPC Endpoint for Textract."
1357+
value = flatten(aws_vpc_endpoint.textract.*.network_interface_ids)
1358+
}
1359+
1360+
output "vpc_endpoint_textract_dns_entry" {
1361+
description = "The DNS entries for the VPC Endpoint for Textract."
1362+
value = flatten(aws_vpc_endpoint.textract.*.dns_entry)
1363+
}
1364+
13501365
# VPC flow log
13511366
output "vpc_flow_log_id" {
13521367
description = "The ID of the Flow Log resource"

variables.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,30 @@ variable "ssmmessages_endpoint_private_dns_enabled" {
538538
default = false
539539
}
540540

541+
variable "enable_textract_endpoint" {
542+
description = "Should be true if you want to provision an Textract endpoint to the VPC"
543+
type = bool
544+
default = false
545+
}
546+
547+
variable "textract_endpoint_security_group_ids" {
548+
description = "The ID of one or more security groups to associate with the network interface for Textract endpoint"
549+
type = list(string)
550+
default = []
551+
}
552+
553+
variable "textract_endpoint_subnet_ids" {
554+
description = "The ID of one or more subnets in which to create a network interface for Textract endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used."
555+
type = list(string)
556+
default = []
557+
}
558+
559+
variable "textract_endpoint_private_dns_enabled" {
560+
description = "Whether or not to associate a private hosted zone with the specified VPC for Textract endpoint"
561+
type = bool
562+
default = false
563+
}
564+
541565
variable "enable_transferserver_endpoint" {
542566
description = "Should be true if you want to provision a Transfer Server endpoint to the VPC"
543567
type = bool

vpc-endpoints.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,3 +1439,26 @@ resource "aws_vpc_endpoint" "codedeploy_commands_secure" {
14391439

14401440
tags = local.vpce_tags
14411441
}
1442+
1443+
#############################################
1444+
# VPC Endpoint for Textract
1445+
#############################################
1446+
data "aws_vpc_endpoint_service" "textract" {
1447+
count = var.create_vpc && var.enable_textract_endpoint ? 1 : 0
1448+
1449+
service = "textract"
1450+
}
1451+
1452+
resource "aws_vpc_endpoint" "textract" {
1453+
count = var.create_vpc && var.enable_textract_endpoint ? 1 : 0
1454+
1455+
vpc_id = local.vpc_id
1456+
service_name = data.aws_vpc_endpoint_service.textract[0].service_name
1457+
vpc_endpoint_type = "Interface"
1458+
1459+
security_group_ids = var.textract_endpoint_security_group_ids
1460+
subnet_ids = coalescelist(var.textract_endpoint_subnet_ids, aws_subnet.private.*.id)
1461+
private_dns_enabled = var.textract_endpoint_private_dns_enabled
1462+
1463+
tags = local.vpce_tags
1464+
}

0 commit comments

Comments
 (0)