AWS Lambda: Support Fn::Split in `vpc.securityGroupIds` and `vpc.subnetIds` configurations
See original GitHub issuesls
produces correct CloudFormation, but issues a configuration warning. This has been discussed and fixed in issue #8282 but I guess Split
function slipped the radar.
serverless.yml
service: hello-world
frameworkVersion: '2'
provider:
name: aws
runtime: nodejs12.x
vpc:
subnetIds: !Split
- ','
- "sn1,sn2"
securityGroupIds: !Split
- ','
- "sg1,sg2"
functions:
hello:
handler: handler.hello
output
✔ ~/src/testing/serverless-fw/hello-world ➭ sls package
Serverless: Configuration warning:
Serverless: at 'provider.vpc.securityGroupIds': should be array
Serverless: at 'provider.vpc.subnetIds': should be array
Serverless:
Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation
Serverless:
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Installed version
Framework Core: 2.11.1 (local)
Plugin: 4.1.2
SDK: 2.3.2
Components: 3.3.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:22 (10 by maintainers)
Top Results From Across the Web
Configuring a Lambda function to access resources in a VPC
You can configure a Lambda function to connect to private subnets in a virtual private cloud (VPC) in your AWS account. Use Amazon...
Read more >Lambda::Function VpcConfig - AWS CloudFormation
When you connect a function to a VPC, Lambda creates an elastic network interface for each combination of security group and subnet in...
Read more >Using AWS Lambda IAM condition keys for VPC settings
The three new condition keys for VPC settings are lambda:VpcIds, lambda:SubnetIds, and lambda:SecurityGroupIds. The keys allow you to ensure ...
Read more >VpcConfig - AWS Lambda
A list of VPC security group IDs. Type: Array of strings. Array Members: Maximum number of 5 items. Required: No. SubnetIds. A list...
Read more >AWS::Lambda::Function VpcConfig - AWS CloudFormation
A list of VPC security group IDs. Required: No. Type: List of String. Maximum: 5. Update requires: No interruption. SubnetIds.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vmj this is just a nitpick, because I seen this everywhere, you wrote:
it’s probably better to write it like this:
I doubt this will solve the original issue (I think it will require serverless code change), but it makes easier to read when the long form is used.
@medikoo to answer your question here’s what I’m doing in my configuration:
Ideally I think all functions should be supported. I also think this will be a problem for validation. For example if I use !Ref it typically is a string, but I believe it could also be an array if I would use a parameter of an array type (it doesn’t look to me like it makes sense to use parameters, but maybe there actually is a use case where it would be beneficial)
@younghoonk17 in terms of
Fn::GetAtt
, it is supported, but on item level not array level, so following will work: