Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable subnet and security group configuration in Cloudformation #191

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ Parameters:
Type: String
Description: Minimum time interval between polls. If a larger interval is provided by Buildkite, that is used instead.
Default: "10s"

SecurityGroupIds:
Description: "Comma separated list of security group IDs to run the lambda in. Defaults to not configuring security groups."
Type: CommaDelimitedList
Default: ""

SubnetIds:
Description: "Comma separated list of subnet IDs to run the lambda in. Defaults to not configuring subnets."
Type: CommaDelimitedList
Default: ""

Conditions:
CreateRole:
Expand All @@ -102,6 +112,20 @@ Conditions:
!Not [ !Equals [ !Ref BuildkiteAgentTokenParameterStoreKMSKey, "" ] ]
SetRolePermissionsBoundaryARN:
!Not [ !Equals [ !Ref RolePermissionsBoundaryARN, "" ] ]
SetSecurityGroups:
Fn::Not:
- Fn::Equals:
- Fn::Join:
- ""
- Ref: SecurityGroupIds
- ""
SetSubnets:
Fn::Not:
- Fn::Equals:
- Fn::Join:
- ""
- Ref: SubnetIds
- ""

Mappings:
LambdaBucket:
Expand Down Expand Up @@ -195,6 +219,9 @@ Resources:
Architectures:
- x86_64
MemorySize: 128
VpcConfig:
SecurityGroupIds: !If [ SetSecurityGroups, !Split [',', !Join [',', !Ref SecurityGroupIds]], !Ref "AWS::NoValue" ]
SubnetIds: !If [ SetSubnets, !Split [',', !Join [',', !Ref SubnetIds]], !Ref "AWS::NoValue" ]
Environment:
Variables:
BUILDKITE_AGENT_TOKEN_SSM_KEY: !Ref BuildkiteAgentTokenParameter
Expand Down