-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(efs): EFS fails to create when using a VPC with multiple subnets per availability zone #12097
Conversation
Title does not follow the guidelines of Conventional Commits. Please adjust title before merge. |
This fix breaks the existing test. Existing tests expect a mount target to be created even if you only specify vpc. Is this the expected specification?
If so, if only VPC is specified, is it better to create a mount target for each AZ subnet in vpc instead of not generating a mount target? |
@@ -272,11 +272,13 @@ export class FileSystem extends Resource implements IFileSystem { | |||
defaultPort: ec2.Port.tcp(FileSystem.DEFAULT_PORT), | |||
}); | |||
|
|||
this.mountTargetsAvailable = []; | |||
if (props.vpcSubnets === undefined) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add a test for this. should there be a warning or error to indicate that mounts targets are not created
@daisuke-yoshimoto thanks for submitting this fix! i'd been trying to reproduce the failure conditions for a little bit now. can you ensure you update the commit details to include the scenario where this case materializes? It should be captured in the commit details along with the approach taken to resolve it. |
Pull request has been modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moving to request changes
as mergify dismissed previous review - but there's still outstanding feedback.
Thank you for your review. So, I will follow the instructions and write the explanation and add the test. As for the specifications, like the console screen and CloudFormation, if we specify only VPC, the mount target will not be generated, so it's okay, isn't it? |
Pull request has been modified.
Sorry I made you wait. I wrote a description of the PR and fixed the test cases. |
Can you please review this PR? |
@daisuke-yoshimoto You still up for wrapping this one out? Just a simple unit test would do. |
DeletionPolicy: 'Retain', | ||
UpdateReplacePolicy: 'Retain', | ||
}, ResourcePart.CompleteDefinition)); | ||
expectCDK(stack).to(haveResource('AWS::EFS::MountTarget')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't strictly assert that only one mount target is created per az. You should validate that only one such resource exists.
Pull request has been modified.
})); | ||
expectCDK(stack).to(countResources('AWS::EFS::MountTarget', 2)); | ||
expectCDK(stack).to(haveResource('AWS::EFS::MountTarget', { | ||
SubnetId: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this ensure that the mount targets are created in different az's?
Seems to me that the subnets you are asserting on might be in the same AZ.
I think your previous approach was good, creating a vpc with a single az and two subnets, you just needs to assert only a single mount target was created even though there are two subnets in the VPC.
Pull request has been modified.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…per availability zone (aws#12097) Fixes aws#10170 ### Fixes This PR has been modified so that it does not create a mount target if only VPC is specified in the EFS file system. ### Bug Currently, if a VPC is specified and no subnet is specified, the subnet search criteria are passed as undefined, all subnets in the VPC are retrieved, and mount targets are generated for all subnets in the VPC. I will. Since mount targets can only be created in one subnet for each Availability Zone, the above behavior will result in duplicate Availability Zones between mount targets, resulting in an error when creating the mount target. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes #10170
Fixes
This PR has been modified so that it does not create a mount target if only VPC is specified in the EFS file system.
Bug
Currently, if a VPC is specified and no subnet is specified, the subnet search criteria are passed as undefined, all subnets in the VPC are retrieved, and mount targets are generated for all subnets in the VPC. I will. Since mount targets can only be created in one subnet for each Availability Zone, the above behavior will result in duplicate Availability Zones between mount targets, resulting in an error when creating the mount target.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license