Skip to content

Commit

Permalink
removing mount targets info
Browse files Browse the repository at this point in the history
  • Loading branch information
yashda committed Mar 4, 2020
1 parent 2caba56 commit f972d4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
16 changes: 1 addition & 15 deletions packages/@aws-cdk/aws-efs/lib/efs-file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,11 @@ export class EfsFileSystem extends EfsFileSystemBase {
*/
public readonly connections: ec2.Connections;

/**
* Identifiers of the mount targets
*/
public readonly mountTargetIdentifiers: string[] = [];

/**
* IP Addresses of the mount targets
*/
public readonly mountTargetIpAddress: string[] = [];

/**
* @attribute
*/
public readonly fileSystemId: string;

private readonly mountTargets: CfnMountTarget[] = [];
private readonly efsFileSystem: CfnFileSystem;

/**
Expand Down Expand Up @@ -281,16 +270,13 @@ export class EfsFileSystem extends EfsFileSystemBase {
// We now have to create the mount target for each of the mentioned subnet
let mountTargetCount = 0;
subnets.subnetIds.forEach((subnetId: string) => {
const efsMountTarget = new CfnMountTarget(this,
new CfnMountTarget(this,
"EfsMountTarget" + (++mountTargetCount),
{
fileSystemId: this.fileSystemId,
securityGroups: Array.of(securityGroup.securityGroupId),
subnetId
});
this.mountTargets.push(efsMountTarget);
this.mountTargetIdentifiers.push(efsMountTarget.ref);
this.mountTargetIpAddress.push(efsMountTarget.attrIpAddress);
});
}
}
5 changes: 1 addition & 4 deletions packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ beforeEach( () => {

test('default file system is created correctly', () => {
// WHEN
const efs = new EfsFileSystem(stack, 'EfsFileSystem', {
new EfsFileSystem(stack, 'EfsFileSystem', {
vpc,
});
// THEN
expectCDK(stack).to(haveResource('AWS::EFS::FileSystem'));
expectCDK(stack).to(haveResource('AWS::EFS::MountTarget'));
expectCDK(stack).to(haveResource('AWS::EC2::SecurityGroup'));

expect(efs.mountTargetIpAddress.length).toEqual(vpc.selectSubnets().subnetIds.length);
expect(efs.mountTargetIdentifiers.length).toEqual(vpc.selectSubnets().subnetIds.length);
});

test('unencrypted file system is created correctly with default KMS', () => {
Expand Down

0 comments on commit f972d4b

Please sign in to comment.