Skip to content

AWS VPC Endpoints Terraform sub-module

Terraform sub-module which creates VPC endpoint resources on AWS.

Usage

See examples directory for working examples to reference:

module "endpoints" {
  source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints"

  vpc_id             = "vpc-12345678"
  security_group_ids = ["sg-12345678"]

  endpoints = {
    s3 = {
      # interface endpoint
      service             = "s3"
      private_dns_enabled = true
      tags                = { Name = "s3-vpc-endpoint" }
    },
    dynamodb = {
      # gateway endpoint
      service         = "dynamodb"
      route_table_ids = ["rt-12322456", "rt-43433343", "rt-11223344"]
      tags            = { Name = "dynamodb-vpc-endpoint" }
    },
    sns = {
      service    = "sns"
      subnet_ids = ["subnet-12345678", "subnet-87654321"]
      tags       = { Name = "sns-vpc-endpoint" }
    },
    sqs = {
      service             = "sqs"
      private_dns_enabled = true
      security_group_ids  = ["sg-987654321"]
      subnet_ids          = ["subnet-12345678", "subnet-87654321"]
      tags                = { Name = "sqs-vpc-endpoint" }
    },
  }

  tags = {
    Owner       = "user"
    Environment = "dev"
  }
}

Examples

Requirements

Name Version
terraform >= 0.12.26
aws >= 3.15

Providers

Name Version
aws >= 3.15

Modules

No modules.

Resources

Name Type
aws_vpc_endpoint.this resource
aws_vpc_endpoint_service.this data source

Inputs

Name Description Type Default Required
create Determines whether resources will be created bool true no
endpoints A map of interface and/or gateway endpoints containing their properties and configurations any {} no
security_group_ids Default security group IDs to associate with the VPC endpoints list(string) [] no
subnet_ids Default subnets IDs to associate with the VPC endpoints list(string) [] no
tags A map of tags to use on all resources map(string) {} no
timeouts Define maximum timeout for creating, updating, and deleting VPC endpoint resources map(string) {} no
vpc_id The ID of the VPC in which the endpoint will be used string null no

Outputs

Name Description
endpoints Array containing the full resource object and attributes for all endpoints created