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(efs): Filesystem.addAccessPoint() #8737

Merged
merged 3 commits into from Jun 26, 2020
Merged

feat(efs): Filesystem.addAccessPoint() #8737

merged 3 commits into from Jun 26, 2020

Conversation

pahud
Copy link
Contributor

@pahud pahud commented Jun 25, 2020

feat(efs): addAccessPoint() support for efs FileSystem


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@pahud
Copy link
Contributor Author

pahud commented Jun 25, 2020

Trying to add addAccessPoint() for efs.FileSystem now.

My integ test looks like this:

import * as ec2 from '@aws-cdk/aws-ec2';
import * as cdk from '@aws-cdk/core';
import { FileSystem } from '../lib';

const app = new cdk.App();
const stack = new cdk.Stack(app, 'test-efs-integ');

const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 3, natGateways: 1});

const fileSystem = new FileSystem(stack, 'FileSystem', {
  vpc,
});

fileSystem.addAccessPoint('AccessPoint', {
  createAcl: {
    ownerGid: '1000',
    ownerUid: '1000',
    permissions: '755',
  },
  path: '/custom-path',
  posixUser: {
    gid: '1000',
    uid: '1000',
  },
})

But I am getting the error: Error: There is already a Construct with name 'Resource' in FileSystem [FileSystem]

$ ../../../node_modules/.bin/cdk --app 'test/integ.efs.js' diff
/home/ec2-user/github/aws-cdk/node_modules/constructs/lib/construct.js:414
throw new Error(There is already a Construct with name '${childName}' in ${typeName}${name.length > 0 ? ' [' + name + ']' : ''});
^

Error: There is already a Construct with name 'Resource' in FileSystem [FileSystem]
at Node.addChild (/home/ec2-user/github/aws-cdk/node_modules/constructs/lib/construct.js:414:19)
at new Node (/home/ec2-user/github/aws-cdk/node_modules/constructs/lib/construct.js:31:28)
at new ConstructNode (/home/ec2-user/github/aws-cdk/packages/@aws-cdk/core/lib/construct-compat.js:148:28)

@pahud
Copy link
Contributor Author

pahud commented Jun 25, 2020

Hi @nija-at and @jogold

Can you help check it out and advise how to fix this error?

Thanks!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 80bca9e
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@jogold
Copy link
Contributor

jogold commented Jun 25, 2020

@pahud the problem lies here:

const resource = new CfnAccessPoint(scope, 'Resource', {

you should be using this instead of sope

 const resource = new CfnAccessPoint(this, 'Resource', { 

= creating the CfnAccessPoint in the scope of the AccessPoint and not in the scope of its passed scope, otherwise you get the name collision because your CfnAccessPoint with id Resource gets created in the scope of the file system which already has a Resource node.

(might be something an awslint rule could have picked up)

@pahud
Copy link
Contributor Author

pahud commented Jun 25, 2020

@pahud the problem lies here:

const resource = new CfnAccessPoint(scope, 'Resource', {

you should be using this instead of sope

 const resource = new CfnAccessPoint(this, 'Resource', { 

= creating the CfnAccessPoint in the scope of the AccessPoint and not in the scope of its passed scope, otherwise you get the name collision because your CfnAccessPoint with id Resource gets created in the scope of the file system which already has a Resource node.

(might be something an awslint rule could have picked up)

This is super helpful! Thanks for the insight!

@pahud pahud marked this pull request as ready for review June 25, 2020 23:36
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: c1e539d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@pahud
Copy link
Contributor Author

pahud commented Jun 25, 2020

Hi @nija-at , all checks passed. Would you please check this out? Thanks.

@nija-at nija-at changed the title feat(efs): addAccessPoint() support for efs FileSystem feat(efs): addAccessPoint() Jun 26, 2020
@nija-at nija-at changed the title feat(efs): addAccessPoint() feat(efs): Filesystem.addAccessPoint() Jun 26, 2020
@mergify
Copy link
Contributor

mergify bot commented Jun 26, 2020

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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: a50d432
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Jun 26, 2020

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).

@mergify mergify bot merged commit 127547a into aws:master Jun 26, 2020
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.

None yet

5 participants