Skip to content

Commit

Permalink
email aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
hans-m-song committed Feb 13, 2023
1 parent d4b9a0a commit 353bd0a
Show file tree
Hide file tree
Showing 10 changed files with 5,682 additions and 2,548 deletions.
7 changes: 7 additions & 0 deletions aws/handlers/forward-email.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { SNSHandler } from "aws-lambda";

const inboxBucketARN = process.env.INBOX_BUCKET;

export const handler: SNSHandler = async (event) => {
console.log(JSON.stringify({ inboxBucketARN, event }));
};
11 changes: 11 additions & 0 deletions aws/handlers/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@iac-aws/handlers",
"dependencies": {
"@aws-sdk/client-s3": "^3.267.0",
"@aws-sdk/client-ses": "^3.267.0",
"aws-lambda": "^1.0.7"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.110"
}
}
2 changes: 2 additions & 0 deletions aws/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export enum SSM {
GithubActionsSongMatrixECRPublisherRoleARN = "/infrastructure/github/actions_songmatrix_ecr_image_publisher_role_arn",

Auth0OIDCProviderARN = "/infrastructure/auth0/oidc_provider_arn",

EmailIdentityName = "/infrastructure/email/identity_name",
}

export enum ECR {
Expand Down
4 changes: 2 additions & 2 deletions aws/lib/constructs/iam/GithubActionsRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export class GithubActionsFederatedPrincipal extends FederatedPrincipal {
super(
props.providerArn,
{
"StringEquals": {
StringEquals: {
[`${Domain.GithubActionsToken}:aud`]:
Domain.GithubActionsOIDCAudience,
},
"ForAnyValue:StringLike": {
StringLike: {
[`${Domain.GithubActionsToken}:sub`]:
GithubActionsFederatedPrincipal.formatClaims(props.claims),
},
Expand Down
29 changes: 29 additions & 0 deletions aws/lib/constructs/lambda/NodejsFunction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Runtime } from "aws-cdk-lib/aws-lambda";
import {
NodejsFunction as CDKNodejsFunction,
NodejsFunctionProps as CDKNodejsFunctionProps,
} from "aws-cdk-lib/aws-lambda-nodejs";
import { Construct } from "constructs";
import path from "path";

export interface NodejsFunctionProps extends CDKNodejsFunctionProps {
// TODO
// newrelicInstrumentation?: boolean;
entry: string;
}

export class NodejsFunction extends CDKNodejsFunction {
constructor(scope: Construct, id: string, { ...props }: NodejsFunctionProps) {
super(scope, id, {
runtime: Runtime.NODEJS_16_X,
...props,
entry: path.resolve(process.cwd(), props.entry),
bundling: {
minify: true,
sourceMap: true,
keepNames: true,
...props.bundling,
},
});
}
}
Loading

0 comments on commit 353bd0a

Please sign in to comment.