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

fix(utils): address issues in printing override warnings #1113

Merged
merged 7 commits into from
May 6, 2024

Conversation

biffgaut
Copy link
Contributor

Issue 1 - Spurious overwrite warnings come up when synth’ing a stack using aws-openapigateway-lambda.

Cause – we use buildLambdaFunction() in the TemplateWriter custom resource. We fully specify the props, including the role. When overrideProps is called – this generates warnings (that have nothing to do with the client’s infrastructure or props)

Changes:

  • Change ConsolidateProps() to print warnings when customer props overwrite defaults, but not when Construct props overwrite customer props (will be great as long as people used consolidateProps correctly)
  • update template-writer to not send a role to buildLambaFunction, but to update the role afterwards (this is how constructs do it)

Issue 2 – deepdiff() dies. This is for 2 reasons.

Reason 1 – some properties do not have scalar values, such as maxRecordAge, which has a cdk.Duration.minutes(5) value. This causes deepdiff() to die. We have a prefilter list of values to ignore so this doesn’t happen, but if the customer does overwrite one of those values they won’t be informed.

Change– when we skip a value because it is in the prefilter list we print a warning that we cannot report on that value (is completely open with client, but will lead to noise)

Reason 2 – circular references in the props cause an infinite loop that exhausts memory requirements

Change – constructs in the props object seem to be the primary cause of this – let’s add ‘node’ to the prefilter list so deepdiff doesn’t dive into a CDK construct in props. We can print out a different warning for ‘node’ than for other prefilter list values

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: githubautobuild-for-cdk-v2
  • Commit ID: 1b4c685
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: githubautobuild-for-cdk-v2
  • Commit ID: f17f794
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

georgebearden
georgebearden previously approved these changes May 1, 2024
Copy link
Contributor

@georgebearden georgebearden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@@ -456,6 +456,7 @@ test("Custom resource is provisioned if encryption key is provided as bucketProp
}
});
const template = Template.fromStack(stack);
defaults.printWarning(`******************${JSON.stringify(template)}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intended to leave this line?

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: githubautobuild-for-cdk-v2
  • Commit ID: 526c978
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: githubautobuild-for-cdk-v2
  • Commit ID: 9aaa229
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: githubautobuild-for-cdk-v2
  • Commit ID: 2c99073
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

georgebearden
georgebearden previously approved these changes May 6, 2024
Copy link
Contributor

@georgebearden georgebearden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@@ -35,19 +35,38 @@ import { Construct } from 'constructs';
import { Stack, StackProps } from 'aws-cdk-lib';
import { ConstructsFactories } from '@aws-solutions-constructs/aws-constructs-factories';

const factories = new ConstructsFactories(this, 'integ-test');
const factories = new ConstructsFactories(this, MyFactories');
Copy link
Contributor

@hayesry hayesry May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Missing an open apostrophe before MyFactories

edit: typo

hayesry
hayesry previously approved these changes May 6, 2024
@biffgaut biffgaut dismissed stale reviews from hayesry and georgebearden via 683a153 May 6, 2024 14:33
@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: githubautobuild-for-cdk-v2
  • Commit ID: 683a153
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@biffgaut biffgaut merged commit 1732949 into main May 6, 2024
2 checks passed
@biffgaut biffgaut deleted the OverrideIssues branch May 6, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants