terraform-aws-modules/terraform-aws-vpc

module vpc-endpoints to support non-AWS endpoint services

sjwl opened this issue · 4 comments

sjwl commented

Is your request related to a problem? Please describe.

when trying to add a vpc endpoint to a non-AWS service, I see this error

│ Error: multiple EC2 VPC Endpoint Services matched; use additional constraints to reduce matches to a single EC2 VPC Endpoint Service
│ 
│   with module.vpc_endpoints.data.aws_vpc_endpoint_service.this["my_company_artifactory"],
│   on .terraform/modules/vpc_endpoints/modules/vpc-endpoints/main.tf line 11, in data "aws_vpc_endpoint_service" "this":
│   11: data "aws_vpc_endpoint_service" "this" {

Describe the solution you'd like.

Similar to how this documentation shows how to create a vpc endpoint to a non-AWS service, the vpc-endpoints module should document how to support this scenario.

Describe alternatives you've considered.

a workaround is to insert a dummy line service = "s3" like so

module "vpc_endpoints" {
  source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints"
  version = "v5.7.0"

  create = var.create_vpc_endpoints && var.create_vpc

  vpc_id = try(module.vpc[0].vpc_id, null)
  create_security_group = false

  endpoints = {
    my_company_artifactory = {
      service = "s3" #hack workaround
      service_endpoint = "com.amazonaws.vpce.us-west-2.vpce-svc-07<redacted>b4"
      subnet_ids = try(module.vpc[0].private_subnets, [])
    }
  }
}

Additional context

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

This issue was automatically closed because of stale in 10 days

@sjwl I've prepared solution for your problem - are you able to double check it , please ?

I was also thinking about creating additional example with non-AWS endpoint service, but I'm not sure if that should be a part of this PR #1152 or a new PR or we should not have such example at all.

@bryantbiggs are you able to take a look on PR #1152, please ?