Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit ddb9406

Browse files
authored
Updates for release v1.0.4
updates for release v1.0.4
2 parents d0d2b49 + e3b44bc commit ddb9406

File tree

48 files changed

+6638
-5943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+6638
-5943
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.4] - 2024-01-11
9+
10+
### Updated
11+
12+
- AWS CDK and SDK upgrades
13+
- Fix an intermittent issue in AWS CloudFormation by setting explicit dependencies between resources
14+
815
## [1.0.3] - 2023-12-07
916

1017
### Updated

source/infrastructure/cdk.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true,
6363
"solution_id": "SO0281",
6464
"solution_name": "enhanced-document-understanding-on-aws",
65-
"solution_version": "v1.0.3",
65+
"solution_version": "v1.0.4",
6666
"app_namespace": "app.idp",
6767
"app_registry_name": "enhanced-document-understanding",
6868
"application_type": "AWS-Solutions",

source/infrastructure/lib/s3web/static-site.ts

Lines changed: 56 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import * as iam from 'aws-cdk-lib/aws-iam';
1919
import * as s3 from 'aws-cdk-lib/aws-s3';
2020
import { NagSuppressions } from 'cdk-nag';
2121
import { Construct } from 'constructs';
22-
import * as crypto from 'crypto';
2322

2423
/**
2524
* Interface that defines properties required for the Static Website
@@ -107,7 +106,62 @@ export class StaticWebsite extends Construct {
107106
defaultRootObject: 'login.html'
108107
}
109108
});
110-
cloudfrontToS3.cloudFrontLoggingBucket?.node.addDependency(bucketPolicyUpdateCustomResource);
109+
110+
const cloudFrontLogsLoggingPrefix = 'cloudfrontlogs-logging';
111+
112+
const cloudFrontLoggingUpdateBucketPolicy = new cdk.CustomResource(
113+
this,
114+
'CloudFrontLoggingUpdateBucketPolicy',
115+
{
116+
resourceType: 'Custom::UpdateBucketPolicy',
117+
serviceToken: props.customResourceLambdaArn,
118+
properties: {
119+
Resource: 'UPDATE_BUCKET_POLICY',
120+
SOURCE_BUCKET_NAME: cloudfrontToS3.cloudFrontLoggingBucket?.bucketName,
121+
LOGGING_BUCKET_NAME: props.accessLoggingBucket.bucketName,
122+
SOURCE_PREFIX: cloudFrontLogsLoggingPrefix
123+
}
124+
}
125+
);
126+
127+
cloudFrontLoggingUpdateBucketPolicy.node.addDependency(bucketPolicyForLambda);
128+
129+
const cfnCloudFrontLoggingBucket = cloudfrontToS3.cloudFrontLoggingBucket?.node.defaultChild as s3.CfnBucket;
130+
cfnCloudFrontLoggingBucket.addPropertyOverride('LoggingConfiguration', {
131+
DestinationBucketName: {
132+
'Fn::Select': [
133+
0,
134+
{
135+
'Fn::Split': [
136+
'/',
137+
{
138+
'Fn::Select': [
139+
5,
140+
{
141+
'Fn::Split': [
142+
':',
143+
{
144+
'Ref': 'AccessLoggingBucketArn'
145+
}
146+
]
147+
}
148+
]
149+
}
150+
]
151+
}
152+
]
153+
},
154+
LogFilePrefix: `${cloudFrontLogsLoggingPrefix}/`
155+
});
156+
// disabling versioning, since it was disabled in a previous release, enabling
157+
// versioning now will create a new bucket with an update from the previous version
158+
cfnCloudFrontLoggingBucket.addPropertyDeletionOverride('VersioningConfiguration');
159+
160+
cloudfrontToS3.node.tryFindChild('CloudfrontLoggingBucketAccessLog')?.node.tryRemoveChild('Resource');
161+
cloudfrontToS3.node
162+
.tryFindChild('CloudfrontLoggingBucketAccessLog')
163+
?.node.tryFindChild('Policy')
164+
?.node.tryRemoveChild('Resource');
111165

112166
const cloudfrontFunction = cloudfrontToS3.node
113167
.tryFindChild('SetHttpSecurityHeaders')
@@ -120,73 +174,6 @@ export class StaticWebsite extends Construct {
120174
);
121175

122176
this.cloudFrontDistribution = cloudfrontToS3.cloudFrontWebDistribution;
123-
this.cloudFrontDistribution.node
124-
.tryFindChild('Origin1')
125-
?.node.tryFindChild('S3Origin')
126-
?.node.tryRemoveChild('Resource');
127-
128-
const originAccessControl = new cloudfront.CfnOriginAccessControl(this, 'OAC', {
129-
originAccessControlConfig: {
130-
name: `BucketOriginAccessControl-${cdk.Aws.REGION}`,
131-
originAccessControlOriginType: 's3',
132-
signingBehavior: 'always',
133-
signingProtocol: 'sigv4'
134-
}
135-
});
136-
137-
// prettier-ignore
138-
let l1CloudFrontDistribution = this.cloudFrontDistribution.node.defaultChild as cdk.aws_cloudfront.CfnDistribution;
139-
// prettier-ignore
140-
l1CloudFrontDistribution.addPropertyOverride('DistributionConfig.Origins.0.OriginAccessControlId', originAccessControl.getAtt('Id'));
141-
// prettier-ignore
142-
l1CloudFrontDistribution.addPropertyOverride('DistributionConfig.Origins.0.S3OriginConfig.OriginAccessIdentity', '');
143-
144-
this.node.tryFindChild('CloudfrontLoggingBucket')?.node.tryRemoveChild('Resource');
145-
this.node.tryFindChild('CloudfrontLoggingBucket')?.node.tryFindChild('Policy')?.node.tryRemoveChild('Resource');
146-
147-
let l1BucketPolicy = this.webS3Bucket.node.tryFindChild('Policy')?.node.defaultChild as s3.CfnBucketPolicy;
148-
l1BucketPolicy.addPropertyOverride('PolicyDocument', {
149-
Statement: [
150-
{
151-
Action: 's3:*',
152-
Condition: {
153-
Bool: {
154-
'aws:SecureTransport': 'false'
155-
}
156-
},
157-
Effect: 'Deny',
158-
Principal: {
159-
AWS: '*'
160-
},
161-
Resource: [`${this.webS3Bucket.bucketArn}`, `${this.webS3Bucket.bucketArn}/*`]
162-
},
163-
{
164-
Action: 's3:GetObject',
165-
Condition: {
166-
StringEquals: {
167-
'AWS:SourceArn': {
168-
'Fn::Join': [
169-
'',
170-
[
171-
'arn:',
172-
`${cdk.Aws.PARTITION}`,
173-
':cloudfront::',
174-
`${cdk.Aws.ACCOUNT_ID}`,
175-
':distribution/',
176-
`${this.cloudFrontDistribution.distributionId}`
177-
]
178-
]
179-
}
180-
}
181-
},
182-
Effect: 'Allow',
183-
Principal: {
184-
Service: 'cloudfront.amazonaws.com'
185-
},
186-
Resource: `${this.webS3Bucket.bucketArn}/*`
187-
}
188-
]
189-
});
190177

191178
// prettier-ignore
192179
new cdk.CfnOutput(cdk.Stack.of(this), 'WebUrl', { // NOSONAR - Typescript construct instantiation

source/infrastructure/lib/s3web/ui-asset.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export class UIAssets extends cdk.NestedStack {
109109
})
110110
]
111111
});
112+
customResourceWebsiteBucketPolicy.node.addDependency(this.staticWebsite.webS3Bucket);
112113
customResourceWebsiteBucketPolicy.attachToRole(customResourceRole);
113114

114115
const ssmParameterPolicy = new iam.Policy(this, 'SSMAccessPolicy', {

source/infrastructure/lib/workflow/standard/standard-workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export class StandardWorkflow extends AbstractWorkflow {
237237
throw new Error('Invalid workflowType');
238238
}
239239

240-
this.map.iterator(mapIteratorState);
240+
this.map.iterator(mapIteratorState); // NOSONAR -typescript:S1874 - in backlog to upgrade with a future release
241241
this.map.next(this.setStatusValue(WorkflowStatus.SUCCESS)).next(this.publishInferenceTask);
242242

243243
return sfn.Chain.start(

0 commit comments

Comments
 (0)