Error using iamManagedPolicies with vpc, separately no error

If I deploy with either vpc or iamManagedProperties there is no problem. If I have both it deploys fine the first time but subsequent deploys fail - same if vpc is a variable or inline:
serverless deploy --stage alpha

An error occurred: IamRoleLambdaExecution - Property ManagedPolicyArns contains duplicate values…

serverless.yml

service:
  name: provisioningData
custom: ${file(./properties.yml):${opt:stage}} #reference the entire file section for stage
provider:
  name: aws
  runtime: nodejs8.10
  region: ${self:custom.region}
  stage: ${self:custom.stage}
  profile: ${self:custom.stage}
  vpc: ${self:custom.vpc}
  iamManagedPolicies:
   - arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole
package:
  exclude:
   - index.js
   - properties.yml
   - .git/**
functions:
  JsApi:
    handler: lambdaFunction.handler
    name: ${self:custom.lambdaName}
    environment:
      clusterEndpoint: ${self:custom.clusterEndpoint}
      clusterPort: ${self:custom.clusterPort}
      connectType: ${self:custom.connectType}
      databaseName: ${self:custom.databaseName}
      password: ${self:custom.password}
      userName: ${self:custom.userName}

example properties.yml

 alpha:
  stage: alpha
  region: us-west-2
  lambdaName: lambdaName
  clusterEndpoint: ip-99-99-99-99
  clusterPort: 9999
  connectType: remote
  databaseName: someDb
  password: dbPass
  userName: dbUser
  vpc:
    securityGroupIds:
     - sg-99999abc
    subnetIds:
     - subnet-999aaab
     - subnet-999bbbc
     - subnet-990cccd
1 Like

If you specified vpc, you do not need to specify AWSLambdaVPCAccessExecutionRole in your iamManagedPolicies.