-
Notifications
You must be signed in to change notification settings - Fork 15
Possible to reference a Security Group being created? #44
Copy link
Copy link
Open
Description
In my serverless.yml I create the following security group in the resources section:
resources:
Resources:
MySecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow all outbound traffic, no inbound for Lambdas
SecurityGroupEgress:
- IpProtocol: tcp
FromPort: 443
ToPort: 443
CidrIp: 0.0.0.0/0
VpcId: ${self:custom.${self:provider.stage}.vpcId}
Then in my functions I reference it as:
functions:
mylambda:
handler: api/my.lambda
runtime: nodejs14.x
vpc:
securityGroupIds:
- Ref: MySecurityGroup
This has the side effect of giving the following configuration warning, even though its not really an issue, because I reference the subnets in the custom.vpcDiscovery:
Serverless: Configuration warning:
Serverless: at 'functions.myLambda.vpc': should have required property 'subnetIds'
So I was wondering if I could remove the vpc.securityGroupIds altogether and just reference MySecurityGroup in the plugin config:
vpcDiscovery:
vpcName: ${self:custom.tk.vpc}
subnets:
- tagKey: Name
tagValues:
- app_sn_0
- app_sn_1
- app_sn_2
securityGroups:
- Ref: MySecurityGroup
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels