Skip to content

Notice: aws_vpc_endpoint_service: Error: multiple VPC Endpoint Services matched #17417

@breathingdust

Description

@breathingdust

Problem

For those users who are encountering the following error when using the aws_vpc_endpoint_service data source:

 Error: multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service
  • AWS have just released a new feature in S3 (PrivateLink) which means that multiple results are now being returned when searching for the S3 endpoint service.
  • Singular data sources in the Terraform AWS Provider (like aws_vpc_endpoint_service) return an error if multiple results are returned.

Configuration changes required to resolve the issue

Add a filter block to select a service type, e.g.

data "aws_vpc_endpoint_service" "s3" { service = "s3" filter { name = "service-type" values = ["Gateway"] } }

For provider versions v3.10.0 and up, it is also possible to use the service_type argument for simplifying the configuration:

data "aws_vpc_endpoint_service" "s3" { service = "s3" service_type = "Gateway" }

Please note that if you are using a Terraform module that relies on this datasource, the module itself will need to be updated. Terraform modules are not maintained by HashiCorp, so you will need to reach out to the modules maintainers to make that configuration update.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    service/ec2Issues and PRs that pertain to the ec2 service.staleOld or inactive issues managed by automation, if no further action taken these will get closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions