Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Move lambda to node 16 #77

Merged
merged 8 commits into from
Nov 25, 2024
Merged
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
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"ignorePatterns": ["**/*", "node_modules/**"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
run: pnpm run build-tsc

- name: Lint types and code
run: pnpm run lint
run: pnpm run lint --quiet

- name: Run tests
run: pnpm test
Expand Down
27 changes: 22 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,23 @@ jobs:
uses: actions/setup-node@master
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
scope: '@wanews'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Cache .pnpm-store
uses: actions/cache@v1
- name: Install Pulumi CLI
uses: pulumi/action-install-pulumi-cli@v1

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-southeast-2
role-to-assume: ${{ secrets.AWS_DEV_ACCOUNT_ROLE }}
role-skip-session-tagging: true
role-duration-seconds: 3600

- name: Install pnpm
run: |
Expand All @@ -36,4 +47,10 @@ jobs:
run: pnpm run build-tsc

- name: Lint types and code
run: pnpm run lint
run: pnpm run lint --quiet

- name: Run tests
run: pnpm test

- name: Package
run: pnpm package
2 changes: 1 addition & 1 deletion libs/certificate-validation/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"ignorePatterns": ["!**/*", "node_modules/**"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
Expand Down
2 changes: 1 addition & 1 deletion libs/invoke-step-function/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"ignorePatterns": ["!**/*", "node_modules/**"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
Expand Down
2 changes: 1 addition & 1 deletion libs/pulumi-lambda/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"ignorePatterns": ["!**/*", "node_modules/**"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
Expand Down
140 changes: 70 additions & 70 deletions libs/pulumi-lambda/src/lib/lambda-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,35 @@ export class LambdaFunction extends pulumi.ComponentResource {
},
opts?:
| (pulumi.ComponentResourceOptions & {
/**
* Some versions of pulumi and/or aws-sdk are unable to delete log groups D:<
* This provides a way to alias them, so they don't need to be deleted &
* recreated. More info:
* https://www.pulumi.com/docs/intro/concepts/resources/#aliases
*/
logGroupAliases?: pulumi.ComponentResourceOptions['aliases']

/**
* Allow an existing aws.iam.Role resource to be migrated into this module,
* without module without being deleted & recreated. More info:
* https://www.pulumi.com/docs/intro/concepts/resources/#aliases
*/
executionRoleAliases?: pulumi.ComponentResourceOptions['aliases']

/**
* Allow an existing aws.iam.RolePolicyAttachment resource to be migrated
* into this module without being deleted & recreated. More info:
* https://www.pulumi.com/docs/intro/concepts/resources/#aliases
*/
rolePolicyAttachmentAliases?: pulumi.ComponentResourceOptions['aliases']

/**
* Allow an existing aws.lambda.Function resource to be migrated
* into this module without being deleted & recreated. More info:
* https://www.pulumi.com/docs/intro/concepts/resources/#aliases
*/
functionAliases?: pulumi.ComponentResourceOptions['aliases']
})
/**
* Some versions of pulumi and/or aws-sdk are unable to delete log groups D:<
* This provides a way to alias them, so they don't need to be deleted &
* recreated. More info:
* https://www.pulumi.com/docs/intro/concepts/resources/#aliases
*/
logGroupAliases?: pulumi.ComponentResourceOptions['aliases']

/**
* Allow an existing aws.iam.Role resource to be migrated into this module,
* without module without being deleted & recreated. More info:
* https://www.pulumi.com/docs/intro/concepts/resources/#aliases
*/
executionRoleAliases?: pulumi.ComponentResourceOptions['aliases']

/**
* Allow an existing aws.iam.RolePolicyAttachment resource to be migrated
* into this module without being deleted & recreated. More info:
* https://www.pulumi.com/docs/intro/concepts/resources/#aliases
*/
rolePolicyAttachmentAliases?: pulumi.ComponentResourceOptions['aliases']

/**
* Allow an existing aws.lambda.Function resource to be migrated
* into this module without being deleted & recreated. More info:
* https://www.pulumi.com/docs/intro/concepts/resources/#aliases
*/
functionAliases?: pulumi.ComponentResourceOptions['aliases']
})
| undefined,
) {
super('wanews:lambda', name, {}, opts)
Expand Down Expand Up @@ -111,47 +111,47 @@ export class LambdaFunction extends pulumi.ComponentResource {

this.executionRole = args.executionRoleName
? pulumi
.output(args.executionRoleName)
.apply((role) =>
aws.iam.getRole(
{ name: role },
{
parent: this,
async: true,
},
),
)
.apply((result) =>
aws.iam.Role.get(result.name, result.id, undefined, {
parent: this,
}),
)
.output(args.executionRoleName)
.apply((role) =>
aws.iam.getRole(
{ name: role },
{
parent: this,
async: true,
},
),
)
.apply((result) =>
aws.iam.Role.get(result.name, result.id, undefined, {
parent: this,
}),
)
: args.executionRole
? pulumi.output(args.executionRole)
: pulumi.output(
new aws.iam.Role(
roleName,
{
assumeRolePolicy: {
Version: '2012-10-17',
Statement: [
{
Action: 'sts:AssumeRole',
Principal: {
Service: 'lambda.amazonaws.com',
},
Effect: 'Allow',
},
],
},
tags: args.getTags(name),
},
{
parent: this,
aliases: opts?.executionRoleAliases,
},
),
)
? pulumi.output(args.executionRole)
: pulumi.output(
new aws.iam.Role(
roleName,
{
assumeRolePolicy: {
Version: '2012-10-17',
Statement: [
{
Action: 'sts:AssumeRole',
Principal: {
Service: 'lambda.amazonaws.com',
},
Effect: 'Allow',
},
],
},
tags: args.getTags(name),
},
{
parent: this,
aliases: opts?.executionRoleAliases,
},
),
)

new aws.iam.RolePolicyAttachment(
`${name}-attach-execution-policy`,
Expand All @@ -166,7 +166,7 @@ export class LambdaFunction extends pulumi.ComponentResource {
name,
{
name,
runtime: 'nodejs14.x',
runtime: 'nodejs16.x',
role: this.executionRole.arn.apply(async (arn) => {
if (args.delayLambdaDeployment) {
console.log('waiting for IAM changes to propagate')
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"@nrwl/jest": "13.10.2",
"@nrwl/linter": "13.10.2",
"@nrwl/workspace": "13.10.2",
"@pulumi/aws": "^5.1.3",
"@pulumi/aws": "^5.43.0",
"@pulumi/pagerduty": "^3.4.0",
"@pulumi/pulumi": "^3.29.1",
"@pulumi/pulumi": "^3.35.0",
"@pulumi/random": "^4.4.2",
"@types/debug": "^4.1.7",
"@types/jest": "27.4.1",
Expand Down
Loading
Loading