AWSTemplateFormatVersion: '2010-09-09'
Description: O11y vpc endpoint service

Parameters:
  NLBArn:
    Type: String
  NLBAllowedPrincipals:
    Type: List<String>

Resources:
  VpcEndpointService:
    Type: AWS::EC2::VPCEndpointService
    Properties:
      AcceptanceRequired: false
      NetworkLoadBalancerArns: 
        - !Ref NLBArn

  VPCEndpointServicePermissions:
    Type: AWS::EC2::VPCEndpointServicePermissions
    Properties:
      ServiceId: !Ref VpcEndpointService
      AllowedPrincipals: !Ref NLBAllowedPrincipals

Outputs:
  VpcEndpointServiceId:
    Value: !Ref VpcEndpointService
