Skip to content

Commit 99072ef

Browse files
authored
Merge pull request #191 from klaviyo/support_vpc_config_for_lambda
Enable subnet and security group configuration in Cloudformation
2 parents c5d5d69 + f5b04d2 commit 99072ef

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

template.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ Parameters:
9494
Type: String
9595
Description: Minimum time interval between polls. If a larger interval is provided by Buildkite, that is used instead.
9696
Default: "10s"
97+
98+
SecurityGroupIds:
99+
Description: "Comma separated list of security group IDs to run the lambda in. Defaults to not configuring security groups."
100+
Type: CommaDelimitedList
101+
Default: ""
102+
103+
SubnetIds:
104+
Description: "Comma separated list of subnet IDs to run the lambda in. Defaults to not configuring subnets."
105+
Type: CommaDelimitedList
106+
Default: ""
97107

98108
Conditions:
99109
CreateRole:
@@ -102,6 +112,20 @@ Conditions:
102112
!Not [ !Equals [ !Ref BuildkiteAgentTokenParameterStoreKMSKey, "" ] ]
103113
SetRolePermissionsBoundaryARN:
104114
!Not [ !Equals [ !Ref RolePermissionsBoundaryARN, "" ] ]
115+
SetSecurityGroups:
116+
Fn::Not:
117+
- Fn::Equals:
118+
- Fn::Join:
119+
- ""
120+
- Ref: SecurityGroupIds
121+
- ""
122+
SetSubnets:
123+
Fn::Not:
124+
- Fn::Equals:
125+
- Fn::Join:
126+
- ""
127+
- Ref: SubnetIds
128+
- ""
105129

106130
Mappings:
107131
LambdaBucket:
@@ -195,6 +219,9 @@ Resources:
195219
Architectures:
196220
- x86_64
197221
MemorySize: 128
222+
VpcConfig:
223+
SecurityGroupIds: !If [ SetSecurityGroups, !Split [',', !Join [',', !Ref SecurityGroupIds]], !Ref "AWS::NoValue" ]
224+
SubnetIds: !If [ SetSubnets, !Split [',', !Join [',', !Ref SubnetIds]], !Ref "AWS::NoValue" ]
198225
Environment:
199226
Variables:
200227
BUILDKITE_AGENT_TOKEN_SSM_KEY: !Ref BuildkiteAgentTokenParameter

0 commit comments

Comments
 (0)