forked from philips-labs/terraform-aws-github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use SSM Parameter Store to store secrets
- Loading branch information
Stijn Seghers
committed
Apr 23, 2021
1 parent
797fb7d
commit 1252ffc
Showing
10 changed files
with
91 additions
and
125 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import { scaleUp } from './scale-runners/scale-up'; | ||
import { scaleDown } from './scale-runners/scale-down'; | ||
import { scaleUp as scaleUp_ } from './scale-runners/scale-up'; | ||
import { scaleDown as scaleDown_ } from './scale-runners/scale-down'; | ||
import { SQSEvent, ScheduledEvent, Context } from 'aws-lambda'; | ||
|
||
module.exports.scaleUp = async (event: SQSEvent, context: Context, callback: any) => { | ||
export async function scaleUp(event: SQSEvent, context: Context, callback: any) { | ||
console.dir(event, { depth: 5 }); | ||
try { | ||
for (const e of event.Records) { | ||
await scaleUp(e.eventSource, JSON.parse(e.body)); | ||
await scaleUp_(e.eventSource, JSON.parse(e.body)); | ||
} | ||
return callback(null); | ||
} catch (e) { | ||
console.error(e); | ||
return callback('Failed handling SQS event'); | ||
} | ||
}; | ||
} | ||
|
||
module.exports.scaleDown = async (event: ScheduledEvent, context: Context, callback: any) => { | ||
export async function scaleDown(event: ScheduledEvent, context: Context, callback: any) { | ||
try { | ||
scaleDown(); | ||
scaleDown_(); | ||
return callback(null); | ||
} catch (e) { | ||
console.error(e); | ||
return callback('Failed'); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
modules/runners/lambdas/runners/src/scale-runners/kms/index.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import AWS from 'aws-sdk'; | ||
|
||
AWS.config.update({ | ||
region: process.env.AWS_REGION, | ||
}); | ||
|
||
const ssm = new AWS.SSM({ apiVersion: '2014-11-06' }); | ||
|
||
export async function fetch_parameter(name: string): Promise<string | undefined> { | ||
const data = await ssm.getParameter({ | ||
Name: name, | ||
WithDecryption: true, | ||
}).promise(); | ||
return data.Parameter?.Value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters