Skip to content

Commit

Permalink
feat(aws-cdk-lib): use new L1 codegen (#26318)
Browse files Browse the repository at this point in the history
Replaces the existing `cfn2ts` code generator with the new `spec2cdk` generator based on `@cdklabs/typewriter` and the separately published service spec database `@aws-cdk/aws-service-spec`.

Other neccesary changes are:

- Lowered coverage threshold for branches to 35% since the newly generated code is more expressive. Arguably we should not include generated files in the coverage calculation, but that's a bigger change. 
- Asset hashes in `cfn-include` test changed due to props now being ordered alphabetic. I've manually verified that the templates are otherwise identical.
- Removing `port` property from `neptune-alpha` as this has been removed upstream and is not functional according to the service team.
- Switched `synthetics-alpha` tests to use `testDeprecated()` for anything using the `Canary`. This is due to the removal of the `deleteLambdaResourcesOnCanaryDeletion` prop in the CFN spec. The new codegen marks removed props as deprecated. We will replace this feature with a custom resource soon.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mrgrain authored Jul 13, 2023
1 parent 3e9dfb2 commit f15ed23
Show file tree
Hide file tree
Showing 144 changed files with 5,067 additions and 5,084 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,28 @@
}
}
},
"9f5b5c07b59d14129fb944d5873e7123bd1d5503291b842d691d7f3deb40f917": {
"08c25f680a202dc8635a9be1cb4f95b91c4155f46e7a6857b11eaf621a4b35c7": {
"source": {
"path": "awscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderEA32CB30.nested.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "9f5b5c07b59d14129fb944d5873e7123bd1d5503291b842d691d7f3deb40f917.json",
"objectKey": "08c25f680a202dc8635a9be1cb4f95b91c4155f46e7a6857b11eaf621a4b35c7.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"d81aa5f1c458333209741287a5755fe92d4fcb92f27c01afe0df806cb9fa343f": {
"108400a7d890987dd303c4b58b4e8313c7f496d2f7445eac124a87d660d1052b": {
"source": {
"path": "aws-cdk-dynamodb-global-replicas-provisioned.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "d81aa5f1c458333209741287a5755fe92d4fcb92f27c01afe0df806cb9fa343f.json",
"objectKey": "108400a7d890987dd303c4b58b4e8313c7f496d2f7445eac124a87d660d1052b.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"TableCD117FA1": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"KeySchema": [
"AttributeDefinitions": [
{
"AttributeName": "hashKey",
"KeyType": "HASH"
"AttributeType": "S"
}
],
"AttributeDefinitions": [
"KeySchema": [
{
"AttributeName": "hashKey",
"AttributeType": "S"
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
Expand All @@ -29,6 +29,18 @@
"TableSourceTableAttachedManagedPolicyawscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderOnEventHandlerServiceRoleD9856B771F8F2CCB": {
"Type": "AWS::IAM::ManagedPolicy",
"Properties": {
"Description": {
"Fn::Join": [
"",
[
"DynamoDB replication managed policy for table ",
{
"Ref": "TableCD117FA1"
}
]
]
},
"Path": "/",
"PolicyDocument": {
"Statement": [
{
Expand Down Expand Up @@ -87,18 +99,6 @@
],
"Version": "2012-10-17"
},
"Description": {
"Fn::Join": [
"",
[
"DynamoDB replication managed policy for table ",
{
"Ref": "TableCD117FA1"
}
]
]
},
"Path": "/",
"Roles": [
{
"Fn::GetAtt": [
Expand All @@ -112,6 +112,18 @@
"TableSourceTableAttachedManagedPolicyawscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderIsCompleteHandlerServiceRoleBE2B1C1A5DC546D2": {
"Type": "AWS::IAM::ManagedPolicy",
"Properties": {
"Description": {
"Fn::Join": [
"",
[
"DynamoDB replication managed policy for table ",
{
"Ref": "TableCD117FA1"
}
]
]
},
"Path": "/",
"PolicyDocument": {
"Statement": [
{
Expand All @@ -132,18 +144,6 @@
],
"Version": "2012-10-17"
},
"Description": {
"Fn::Join": [
"",
[
"DynamoDB replication managed policy for table ",
{
"Ref": "TableCD117FA1"
}
]
]
},
"Path": "/",
"Roles": [
{
"Fn::GetAtt": [
Expand Down Expand Up @@ -231,8 +231,6 @@
]
]
},
"ScalableDimension": "dynamodb:table:WriteCapacityUnits",
"ServiceNamespace": "dynamodb",
"RoleARN": {
"Fn::Join": [
"",
Expand All @@ -248,7 +246,9 @@
":role/aws-service-role/dynamodb.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_DynamoDBTable"
]
]
}
},
"ScalableDimension": "dynamodb:table:WriteCapacityUnits",
"ServiceNamespace": "dynamodb"
}
},
"TableWriteScalingTargetTrackingD78DCCD8": {
Expand All @@ -270,6 +270,11 @@
"awscdkawsdynamodbReplicaProviderNestedStackawscdkawsdynamodbReplicaProviderNestedStackResource18E3F12D": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"Parameters": {
"referencetoawscdkdynamodbglobalreplicasprovisionedTable12280A12Ref": {
"Ref": "TableCD117FA1"
}
},
"TemplateURL": {
"Fn::Join": [
"",
Expand All @@ -286,14 +291,9 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/9f5b5c07b59d14129fb944d5873e7123bd1d5503291b842d691d7f3deb40f917.json"
"/08c25f680a202dc8635a9be1cb4f95b91c4155f46e7a6857b11eaf621a4b35c7.json"
]
]
},
"Parameters": {
"referencetoawscdkdynamodbglobalreplicasprovisionedTable12280A12Ref": {
"Ref": "TableCD117FA1"
}
}
},
"UpdateReplacePolicy": "Delete",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@
},
"S3Key": "760886bc5e09df8d8ecf794d3b9604739062c355e50ca5ae1b07e70ec9233e8b.zip"
},
"Handler": "index.onEventHandler",
"Role": {
"Fn::GetAtt": [
"OnEventHandlerServiceRole15A26729",
"Arn"
]
},
"Handler": "index.onEventHandler",
"Runtime": "nodejs18.x",
"Timeout": 300
},
Expand Down Expand Up @@ -183,13 +183,13 @@
},
"S3Key": "760886bc5e09df8d8ecf794d3b9604739062c355e50ca5ae1b07e70ec9233e8b.zip"
},
"Handler": "index.isCompleteHandler",
"Role": {
"Fn::GetAtt": [
"IsCompleteHandlerServiceRole5810CC58",
"Arn"
]
},
"Handler": "index.isCompleteHandler",
"Runtime": "nodejs18.x",
"Timeout": 30
},
Expand Down Expand Up @@ -306,12 +306,6 @@
},
"S3Key": "73b60c2cf141bf58c33cfaa33858f5c84103a0232ba7192d696536488f7731c4.zip"
},
"Role": {
"Fn::GetAtt": [
"ProviderframeworkonEventServiceRole9FF04296",
"Arn"
]
},
"Description": "AWS CDK resource provider framework - onEvent (aws-cdk-dynamodb-global-replicas-provisioned/@aws-cdk--aws-dynamodb.ReplicaProvider/Provider)",
"Environment": {
"Variables": {
Expand All @@ -333,6 +327,12 @@
}
},
"Handler": "framework.onEvent",
"Role": {
"Fn::GetAtt": [
"ProviderframeworkonEventServiceRole9FF04296",
"Arn"
]
},
"Runtime": "nodejs18.x",
"Timeout": 900
},
Expand Down Expand Up @@ -443,12 +443,6 @@
},
"S3Key": "73b60c2cf141bf58c33cfaa33858f5c84103a0232ba7192d696536488f7731c4.zip"
},
"Role": {
"Fn::GetAtt": [
"ProviderframeworkisCompleteServiceRoleB1087139",
"Arn"
]
},
"Description": "AWS CDK resource provider framework - isComplete (aws-cdk-dynamodb-global-replicas-provisioned/@aws-cdk--aws-dynamodb.ReplicaProvider/Provider)",
"Environment": {
"Variables": {
Expand All @@ -467,6 +461,12 @@
}
},
"Handler": "framework.isComplete",
"Role": {
"Fn::GetAtt": [
"ProviderframeworkisCompleteServiceRoleB1087139",
"Arn"
]
},
"Runtime": "nodejs18.x",
"Timeout": 900
},
Expand Down Expand Up @@ -577,12 +577,6 @@
},
"S3Key": "73b60c2cf141bf58c33cfaa33858f5c84103a0232ba7192d696536488f7731c4.zip"
},
"Role": {
"Fn::GetAtt": [
"ProviderframeworkonTimeoutServiceRole28643D26",
"Arn"
]
},
"Description": "AWS CDK resource provider framework - onTimeout (aws-cdk-dynamodb-global-replicas-provisioned/@aws-cdk--aws-dynamodb.ReplicaProvider/Provider)",
"Environment": {
"Variables": {
Expand All @@ -601,6 +595,12 @@
}
},
"Handler": "framework.onTimeout",
"Role": {
"Fn::GetAtt": [
"ProviderframeworkonTimeoutServiceRole28643D26",
"Arn"
]
},
"Runtime": "nodejs18.x",
"Timeout": 900
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"stacks": [
"aws-cdk-dynamodb-global-replicas-provisioned"
],
"diffAssets": true,
"assertionStack": "aws-cdk-dynamodb-global-replicas-provisioned-test/DefaultTest/DeployAssert",
"assertionStackName": "awscdkdynamodbglobalreplicasprovisionedtestDefaultTestDeployAssertE7F91F54"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d81aa5f1c458333209741287a5755fe92d4fcb92f27c01afe0df806cb9fa343f.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/108400a7d890987dd303c4b58b4e8313c7f496d2f7445eac124a87d660d1052b.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down
Loading

0 comments on commit f15ed23

Please sign in to comment.