Skip to content

Commit

Permalink
Support placing the lambda into a VPC
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinAltmayerTMH committed Dec 2, 2024
1 parent 4b53f4d commit b775afc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/SopsSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
CustomResource,
FileSystem,
} from 'aws-cdk-lib';
import { ISecurityGroup, IVpc, SubnetSelection } from 'aws-cdk-lib/aws-ec2';
import {
IGrantable,
IRole,
Expand Down Expand Up @@ -169,10 +170,16 @@ export interface SopsSyncProps extends SopsSyncOptions {
readonly encryptionKey?: IKey;
}

export interface SopsSyncProviderProps {
readonly vpc?: IVpc;
readonly vpcSubnets?: SubnetSelection;
readonly securityGroups?: ISecurityGroup[];
}

export class SopsSyncProvider extends SingletonFunction implements IGrantable {
private sopsAgeKeys: SecretValue[];

constructor(scope: Construct, id?: string) {
constructor(scope: Construct, id?: string, props?: SopsSyncProviderProps) {
super(scope, id ?? 'SopsSyncProvider', {
code: Code.fromAsset(
scope.node.tryGetContext('sops_sync_provider_asset_path') ||
Expand All @@ -190,6 +197,9 @@ export class SopsSyncProvider extends SingletonFunction implements IGrantable {
),
}),
},
vpc: props?.vpc,
vpcSubnets: props?.vpcSubnets,
securityGroups: props?.securityGroups,
});
this.sopsAgeKeys = [];
}
Expand Down

0 comments on commit b775afc

Please sign in to comment.