-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit for serverless integration
- Loading branch information
1 parent
0b301e4
commit 2e8467d
Showing
9 changed files
with
111 additions
and
23 deletions.
There are no files selected for viewing
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,9 @@ | ||
# package directories | ||
node_modules | ||
|
||
# Serverless directories | ||
.serverless | ||
.env.* | ||
|
||
# Other | ||
.DS_Store |
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,2 +1,29 @@ | ||
# aws-oidc-thumbprint | ||
A lambda function to update the AWS OIDC Identity Provider thumbprint | ||
|
||
|
||
## Conf | ||
|
||
Add files for the env variables. | ||
|
||
```bash | ||
mv env.yml .env.yml | ||
``` | ||
|
||
## Setup | ||
|
||
```bash | ||
yarn | ||
``` | ||
|
||
## Deploy | ||
|
||
```bash | ||
serverless deploy | ||
``` | ||
|
||
## Cleanup | ||
|
||
```bash | ||
serverless remove | ||
``` |
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,9 @@ | ||
const Conf = { | ||
APP_IAM_AWS_REGION: process.env.APP_IAM_AWS_REGION, | ||
APP_OIDC_IAM_ARN: process.env.APP_OIDC_IAM_ARN, | ||
OIDC_LOGIN_DOMAIN: process.env.OIDC_LOGIN_DOMAIN | ||
} | ||
|
||
module.exports.config = () => { | ||
return Conf | ||
} |
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,3 @@ | ||
APP_IAM_AWS_REGION: us-east-1 | ||
APP_OIDC_IAM_ARN: arn:aws:iam::xxxxxxxx:oidc-provider/login-domain.com | ||
OIDC_LOGIN_DOMAIN: login-domain.com |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
"use strict"; | ||
|
||
const awsxray = require("aws-xray-sdk-core"); | ||
const aws = (process.env.XRAY_OFF || stage === "testing") ? require("aws-sdk") : awsxray.captureAWS(require("aws-sdk")); | ||
const aws = require("aws-sdk"); | ||
const config = require('../config'); | ||
let awsServices; | ||
|
||
module.exports.aws_iam = ((awsServices) => { | ||
if(!awsServices.iam){ | ||
awsServices.iam = new aws.IAM({region:'us-east-1'}); | ||
if (!awsServices.iam) { | ||
awsServices.iam = new aws.IAM({ region: config().APP_IAM_AWS_REGION }); | ||
} | ||
return awsServices.iam; | ||
}).bind(null, awsServices); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,10 @@ | ||
{ | ||
"name": "aws-oidc-thumbprint", | ||
"version": "0.1.0", | ||
"description": "Updates the OIDC thumbprint as the certificate rotates", | ||
"author": "[email protected]", | ||
"license": "MIT", | ||
"dependencies": { | ||
"openssl-nodejs": "^1.0.5" | ||
} | ||
} |
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 @@ | ||
service: aws-oidc-thumbprint | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs12.x | ||
environment: | ||
APP_IAM_AWS_REGION: ${file(.env.yml):APP_IAM_AWS_REGION} | ||
APP_OIDC_IAM_ARN: ${file(.env.yml):APP_OIDC_IAM_ARN} | ||
|
||
functions: | ||
cron: | ||
handler: handler | ||
events: | ||
# Invoke Lambda function every 5 minute | ||
- schedule: cron(0/1 * * * ? *) |