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

feat(WAF): support associating WAF without creating #504

Merged
merged 7 commits into from
Mar 7, 2023

Conversation

rikhilrai
Copy link
Contributor

@rikhilrai rikhilrai commented Jun 2, 2022

closes #500

same as #501 but into v2 alpha base branch

Copy link
Collaborator

@bboure bboure left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you

Please add AJV validation as suggested and :

@@ -34,6 +34,7 @@ export type IamStatement = {

export type WafConfig = {
enabled?: boolean;
arn?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add AJV validation for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, not sure how I missed those tests. Have added them now, thanks @bboure. Do you mind checking #501 too?

@rikhilrai rikhilrai requested a review from bboure June 5, 2022 15:51
@bboure
Copy link
Collaborator

bboure commented Jun 6, 2022

Thank you. LGTM

One last thing. Would you mind also updating the doc? (on both PRs)

Thank you

@rikhilrai
Copy link
Contributor Author

Absolutely! Added :)

doc/WAF.md Outdated
- `visibilityConfig`: Optional. A [visibility config](https://docs.aws.amazon.com/waf/latest/APIReference/API_VisibilityConfig.html) for this WAF
- `name`: Metric name
- `cloudWatchMetricsEnabled`: A boolean indicating whether the associated resource sends metrics to Amazon CloudWatch
- `sampledRequestsEnabled`: A boolean indicating whether AWS WAF should store a sampling of the web requests that match the rule
- `rules`: An array of [rules](#rules).
- `rules`: Optional. An array of [rules](#rules).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rules is required as per validation
I guess it makes sense to make it optional now.

But it would be great to make it either rules or arn required.
In fact, it would be allowing arn OR the other options (other options except enabled don't make sense if arn is used)

Let me think a bit about this and come with some suggestions.

Feel free to propose some too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @bboure, not sure that we can express this through AJV Validation.

One option is to make arn, rules and other config Optional in the schema and express these rules through code?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have found some tricks that should make this possible.
I will have a go at it when I can.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@rikhilrai Done.
I made some improvements on the validation principally.
I'm also considering renaming arn to something more explicit like webAclArn
WDYT?

@rikhilrai
Copy link
Contributor Author

hey @bboure, thanks for your changes. PR LGTM!

@bboure
Copy link
Collaborator

bboure commented Feb 24, 2023

👍 @rikhilrai

Sorry, I lost track of this PR and now I'm not sure what it does anymore.
I'll dive back into it soon and prepare a merge + release

Thank you

@bboure bboure changed the base branch from alpha to master February 25, 2023 11:51
Copy link
Collaborator

@bboure bboure left a comment

Choose a reason for hiding this comment

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

LGTM!

I left a small comment, but it should not be a blocker.

Will try to release asap

- `visibilityConfig`: Optional. A [visibility config](https://docs.aws.amazon.com/waf/latest/APIReference/API_VisibilityConfig.html) for this WAF
- `name`: Metric name
- `cloudWatchMetricsEnabled`: A boolean indicating whether the associated resource sends metrics to Amazon CloudWatch
- `sampledRequestsEnabled`: A boolean indicating whether AWS WAF should store a sampling of the web requests that match the rule
- `rules`: An array of [rules](#rules).
- `rules`: Required. An array of [rules](#rules). Optional when `arn` is present
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit confusing.
It might let user think that you can pass new rules even if you pass a waWAF arn, which is not from what I can see in the code (the WAF is only associated).
(same for the other attributes).

This is probably fine for now. I'd like to reorganize the whole documentation anyway.

@bboure
Copy link
Collaborator

bboure commented Mar 7, 2023

Thanks!

I'll merge this now.

About doc, I have some new plans to improve it.

@bboure bboure changed the title feat: support associating WAF without creating feat(WAF): support associating WAF without creating Mar 7, 2023
@bboure bboure merged commit 69a110a into sid88in:master Mar 7, 2023
@github-actions
Copy link

github-actions bot commented Mar 7, 2023

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bboure bboure mentioned this pull request Mar 7, 2023
vicary pushed a commit to vicary/serverless-appsync-plugin that referenced this pull request Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for associating an exising WAF
2 participants