Skip to content

Commit

Permalink
feat!: plat-6785 upgrade cdk 1.x -> 2.x (#81)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Upgrade to cdk 1.x -> 2.x
  • Loading branch information
malcyL authored Sep 21, 2023
1 parent 4c7bd4d commit 316f64f
Show file tree
Hide file tree
Showing 96 changed files with 17,183 additions and 14,536 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
LAST_COMMIT=$(git rev-parse HEAD)
echo "FIRST COMMIT: $FIRST_COMMIT"
echo "LAST COMMIT : $LAST_COMMIT"
npx commitlint --from $FIRST_COMMIT --to $LAST_COMMIT --verbose
# npx commitlint --from $FIRST_COMMIT --to $LAST_COMMIT --verbose
build:
executor: default_executor
steps:
Expand Down
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ node_modules
.vscode/

# Typescript is our source-code; generated JS and d.ts is left unlinted.
src/**/*.js
src/**/*.d.ts
lib/**/*.js
lib/**/*.d.ts
test/**/*.js
Expand Down
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ lib/**/*.ts
!lib/**/*.d.ts
test

*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.16.0
18.17.1
55 changes: 55 additions & 0 deletions cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"app": "npx ts-node --prefer-ts-exts bin/talis-cdk-constructs.ts",
"watch": {
"include": ["**"],
"exclude": [
"README.md",
"cdk*.json",
"**/*.d.ts",
"**/*.js",
"tsconfig.json",
"package*.json",
"yarn.lock",
"node_modules",
"test"
]
},
"context": {
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
"@aws-cdk/core:checkSecretUsage": true,
"@aws-cdk/core:target-partitions": ["aws", "aws-cn"],
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
"@aws-cdk/aws-iam:minimizePolicies": true,
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
"@aws-cdk/core:enablePartitionLiterals": true,
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
"@aws-cdk/aws-iam:standardizedServicePrincipals": true,
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
"@aws-cdk/aws-route53-patters:useCertificate": true,
"@aws-cdk/customresources:installLatestAwsSdkDefault": false,
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
"@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true,
"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
"@aws-cdk/aws-redshift:columnId": true,
"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true,
"@aws-cdk/aws-apigateway:requestValidatorUniqueId": true,
"@aws-cdk/aws-kms:aliasNameRef": true,
"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true,
"@aws-cdk/core:includePrefixInUniqueNameGeneration": true,
"@aws-cdk/aws-efs:denyAnonymousAccess": true,
"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true,
"@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true,
"@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import "source-map-support/register";
import * as cdk from "@aws-cdk/core";
import * as cdk from "aws-cdk-lib";
import { ContainerLambdaWorkerStack } from "../lib/container-lambda-worker-stack";

const app = new cdk.App();
Expand All @@ -12,5 +12,5 @@ new ContainerLambdaWorkerStack(
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION,
},
}
},
);
1 change: 1 addition & 0 deletions examples/container-lambda-worker/cdk.context.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"vpc-provider:account=302477901552:filter.vpc-id=vpc-0155db5e1ab5c28b6:region=eu-west-1:returnAsymmetricSubnets=true": {
"vpcId": "vpc-0155db5e1ab5c28b6",
"vpcCidrBlock": "172.16.0.0/16",
"ownerAccountId": "302477901552",
"availabilityZones": [],
"subnetGroups": [
{
Expand Down
63 changes: 50 additions & 13 deletions examples/container-lambda-worker/cdk.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,55 @@
{
"app": "npx ts-node --prefer-ts-exts bin/container-lambda-worker.ts",
"watch": {
"include": ["**"],
"exclude": [
"README.md",
"cdk*.json",
"**/*.d.ts",
"**/*.js",
"tsconfig.json",
"package*.json",
"yarn.lock",
"node_modules",
"test"
]
},
"context": {
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
"@aws-cdk/core:enableStackNameDuplicates": true,
"aws-cdk:enableDiffNoFail": true,
"@aws-cdk/core:stackRelativeExports": true,
"@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true,
"@aws-cdk/aws-secretsmanager:parseOwnedSecretName": true,
"@aws-cdk/aws-kms:defaultKeyPolicies": true,
"@aws-cdk/aws-s3:grantWriteWithoutAcl": true,
"@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount": true,
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
"@aws-cdk/aws-efs:defaultEncryptionAtRest": true,
"@aws-cdk/aws-lambda:recognizeVersionProps": true,
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
"@aws-cdk/core:checkSecretUsage": true,
"@aws-cdk/core:target-partitions": ["aws", "aws-cn"],
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
"@aws-cdk/aws-iam:minimizePolicies": true,
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
"@aws-cdk/core:enablePartitionLiterals": true,
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
"@aws-cdk/aws-iam:standardizedServicePrincipals": true,
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
"@aws-cdk/aws-route53-patters:useCertificate": true,
"@aws-cdk/customresources:installLatestAwsSdkDefault": false,
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
"@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true,
"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
"@aws-cdk/aws-redshift:columnId": true,
"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true,
"@aws-cdk/aws-apigateway:requestValidatorUniqueId": true,
"@aws-cdk/aws-kms:aliasNameRef": true,
"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true,
"@aws-cdk/core:includePrefixInUniqueNameGeneration": true,
"@aws-cdk/aws-efs:denyAnonymousAccess": true,
"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true,
"@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true,
"@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as cdk from "@aws-cdk/core";
import * as cdk from "aws-cdk-lib";
import { aws_ec2 as ec2 } from "aws-cdk-lib";
import { aws_sns as sns } from "aws-cdk-lib";
import { Construct } from "constructs";
import * as path from "path";
import * as sns from "@aws-cdk/aws-sns";
import * as ec2 from "@aws-cdk/aws-ec2";

import { LambdaWorker } from "../../../lib";

export class ContainerLambdaWorkerStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

// Use AWS_PREFIX to give all resources in this sample
Expand All @@ -28,7 +29,7 @@ export class ContainerLambdaWorkerStack extends cdk.Stack {
`${prefix}container-lambda-worker-topic`,
{
topicName: `${prefix}container-lambda-worker-topic`,
}
},
);

// LambdaWorker requires an existing SNS topic to publish alarms to.
Expand All @@ -37,7 +38,7 @@ export class ContainerLambdaWorkerStack extends cdk.Stack {
const alarmTopic = new sns.Topic(
this,
`${prefix}container-lambda-Worker-alarm`,
{ topicName: `${prefix}container-lambda-worker-alarm` }
{ topicName: `${prefix}container-lambda-worker-alarm` },
);

const vpc = ec2.Vpc.fromLookup(this, `${prefix}-vpc`, {
Expand Down Expand Up @@ -89,7 +90,7 @@ export class ContainerLambdaWorkerStack extends cdk.Stack {
}),
},
},
}
},
);
}
}
Loading

0 comments on commit 316f64f

Please sign in to comment.