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

Aspect to enforce unique app/region/stack on lambdas #2567

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Jakeii
Copy link
Member

@Jakeii Jakeii commented Jan 24, 2025

What does this change?

Introduce an Aspect to enforce unique combinations of app/region/stack on GuLambdaFunction.

A few projects at the Guardian seem to be mistakenly doing this, and when used in combination with a generated riff-raff.yaml can cause unexpected behaviour where only the last lambda defined will make it into the the deployments as the app/region/stack combination is used for the key.

I ran into some circular dependency issues, so had to make some imports more specific in some other modules to resolve.

Copy link

changeset-bot bot commented Jan 24, 2025

🦋 Changeset detected

Latest commit: 0aaed07

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@guardian/cdk Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Jakeii Jakeii force-pushed the jlk/aspect-enforce-unique-app-on-lambdas branch from 6cda6ce to f5ddf8b Compare January 24, 2025 14:37
@Jakeii Jakeii marked this pull request as ready for review January 24, 2025 14:51
@Jakeii Jakeii changed the title Aspect to enforce unique app-regoin-stack on lambdas Aspect to enforce unique app/region/stack on lambdas Jan 24, 2025
@Jakeii Jakeii requested a review from akash1810 January 27, 2025 11:57
],
});
expect(() => Template.fromStack(stack)).toThrow(
"GuLambdaFunction must have a unique combination of app, region and stack",
Copy link
Member

Choose a reason for hiding this comment

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

The message above also includes "Found duplicate: ${node.app}". Any reason to not capture that here?

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.

2 participants