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

move to SSM (from S3) for config/secrets #141

Draft
wants to merge 2 commits into
base: upgrade-node
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
32 changes: 30 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ on:
jobs:
CI:
runs-on: ubuntu-latest

permissions:
id-token: write
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3

Expand All @@ -18,7 +21,32 @@ jobs:
cache: npm
cache-dependency-path: 'pan-domain-node/package-lock.json'

- name: JS Build
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
cache-dependency-path: 'cdk/package-lock.json'

- name: synth infra
working-directory: cdk
run: |
npm ci
npm test
npm run synth

- name: Upload infra definitions to Riff-Raff
uses: guardian/actions-riff-raff@v4
with:
roleArn: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
app: pan-domain-authentication
projectName: 'pan-domain-authentication'
configPath: cdk/cdk.out/riff-raff.yaml
contentDirectories: |
cdk.out:
- cdk/cdk.out

- name: pan-domain-node JS Build
run: |
pushd pan-domain-node

Expand Down
11 changes: 11 additions & 0 deletions cdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.js
!jest.config.js
!jest.setup.js
!.eslintrc.js
*.d.ts
node_modules
dist

# CDK asset staging directory
.cdk.staging
cdk.out
5 changes: 5 additions & 0 deletions cdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Infrastructure

This directory defines the components to be deployed to AWS.

See [`package.json`](./package.json) for a list of available scripts.
26 changes: 26 additions & 0 deletions cdk/bin/cdk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import "source-map-support/register";
import {GuRoot} from "@guardian/cdk/lib/constructs/root";
import {PanDomainAuthentication} from "../lib/pan-domain-authentication";

const stack = "pan-domain-authentication";
const env = {region: "eu-west-1"};

const app = new GuRoot();

new PanDomainAuthentication(app, "PanDomainAuthentication-euwest-1-LOCAL", {
stack,
env,
stage: "LOCAL"
});

new PanDomainAuthentication(app, "PanDomainAuthentication-euwest-1-CODE", {
stack,
env,
stage: "CODE"
});

new PanDomainAuthentication(app, "PanDomainAuthentication-euwest-1-PROD", {
stack,
env,
stage: "PROD"
});
7 changes: 7 additions & 0 deletions cdk/cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"app": "npx ts-node bin/cdk.ts",
"context": {
"aws-cdk:enableDiffNoFail": "true",
"@aws-cdk/core:stackRelativeExports": "true"
}
}
1 change: 1 addition & 0 deletions cdk/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jest.mock("@guardian/cdk/lib/constants/tracking-tag");
10 changes: 10 additions & 0 deletions cdk/lib/__snapshots__/pan-domain-authentication.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`The PanDomainAuthentication stack matches the snapshot 1`] = `
{
"Metadata": {
"gu:cdk:constructs": [],
"gu:cdk:version": "TEST",
},
}
`;
12 changes: 12 additions & 0 deletions cdk/lib/pan-domain-authentication.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { App } from "aws-cdk-lib";
import { Template } from "aws-cdk-lib/assertions";
import { PanDomainAuthentication } from "./pan-domain-authentication";

describe("The PanDomainAuthentication stack", () => {
it("matches the snapshot", () => {
const app = new App();
const stack = new PanDomainAuthentication(app, "PanDomainAuthentication", { stack: "pan-domain-authentication", stage: "TEST" });
const template = Template.fromStack(stack);
expect(template.toJSON()).toMatchSnapshot();
});
});
9 changes: 9 additions & 0 deletions cdk/lib/pan-domain-authentication.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { GuStackProps } from "@guardian/cdk/lib/constructs/core";
import { GuStack } from "@guardian/cdk/lib/constructs/core";
import type { App } from "aws-cdk-lib";

export class PanDomainAuthentication extends GuStack {
constructor(scope: App, id: string, props: GuStackProps) {
super(scope, id, props);
}
}
Loading
Loading