@@ -561,10 +561,7 @@ retry:
561
561
S3Bucket : b ,
562
562
S3Key : k ,
563
563
},
564
- VpcConfig : & lambda.VpcConfig {
565
- SubnetIds : aws .StringSlice (p .config .Lambda .VPC .Subnets ),
566
- SecurityGroupIds : aws .StringSlice (p .config .Lambda .VPC .SecurityGroups ),
567
- },
564
+ VpcConfig : p .vpc (),
568
565
})
569
566
570
567
// IAM is eventually consistent apparently, so we have to keep retrying
@@ -622,10 +619,7 @@ func (p *Platform) updateFunction(c *lambda.Lambda, a *apigateway.APIGateway, up
622
619
MemorySize : aws .Int64 (int64 (p .config .Lambda .Memory )),
623
620
Timeout : aws .Int64 (int64 (p .config .Proxy .Timeout + 3 )),
624
621
Environment : env ,
625
- VpcConfig : & lambda.VpcConfig {
626
- SubnetIds : aws .StringSlice (p .config .Lambda .VPC .Subnets ),
627
- SecurityGroupIds : aws .StringSlice (p .config .Lambda .VPC .SecurityGroups ),
628
- },
622
+ VpcConfig : p .vpc (),
629
623
})
630
624
631
625
if err != nil {
@@ -660,6 +654,19 @@ func (p *Platform) updateFunction(c *lambda.Lambda, a *apigateway.APIGateway, up
660
654
return * res .Version , nil
661
655
}
662
656
657
+ // vpc returns the vpc configuration or nil.
658
+ func (p * Platform ) vpc () * lambda.VpcConfig {
659
+ v := p .config .Lambda .VPC
660
+ if v == nil {
661
+ return nil
662
+ }
663
+
664
+ return & lambda.VpcConfig {
665
+ SubnetIds : aws .StringSlice (v .Subnets ),
666
+ SecurityGroupIds : aws .StringSlice (v .SecurityGroups ),
667
+ }
668
+ }
669
+
663
670
// alias creates or updates an alias.
664
671
func (p * Platform ) alias (c * lambda.Lambda , alias , version string ) error {
665
672
log .Debugf ("alias %s to %s" , alias , version )
0 commit comments