Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Added 'subnetGroup' option #65

Merged
merged 5 commits into from
Jun 3, 2019
Merged

Added 'subnetGroup' option #65

merged 5 commits into from
Jun 3, 2019

Conversation

geoseong
Copy link
Contributor

Hi.

I really appreciated to create this plugin. This is really nice~!

so I decided to use this plugin every project since now, but I faced some problem.

I work on Seoul region(ap-northeast-2).
DAX is not available in my region

so I added the option named subnetGroup.
subnetGroup can pick subnet groups which user want to create.

Adding this options, I could avoid the error this plugin tried to make DAX Subnet group.

please consider to be merged.

Thank you~!

to avoid making unsupported subnet group in specific region
@jplock
Copy link
Member

jplock commented May 31, 2019

This looks great. Can you add a test for it?

Copy link
Member

@jplock jplock left a comment

Choose a reason for hiding this comment

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

Few minor comments and then add some tests and this looks good.

README.md Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
Copy link
Contributor Author

@geoseong geoseong left a comment

Choose a reason for hiding this comment

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

thanks for your advice and please wait for the test code.

README.md Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
Copy link
Contributor Author

@geoseong geoseong left a comment

Choose a reason for hiding this comment

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

@jplock I added test code please check this out.

const expected = getSubnetGroupsOptions.reduce((acc, key) => Object.assign(acc, subnetGroupList[key]), {})
const actual = buildSubnetGroups(2, getSubnetGroupsOptions)
expect(actual).toEqual(expected);
expect.assertions(1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this code is unnecessary because no asynchronous code is here. but I just put it on your style :)

}
if (subnetGroups.length > 0) {
return subnetGroups.reduce(function(acc, service) {
let builtSubnetGroup = subnetGroupList[service.toLowerCase()](numZones);
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a check here to ensure service is a valid key in subnetGroupList before trying to call it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added it in src/index.js.
I think this is unavoidable to input validation logic into src/index.js.
because I don't want to get dirty importing serverless.classes.Error object on src/subnet_groups.js

@jplock jplock merged commit f300429 into smoketurner:master Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants