When creating or importing a File System in a CDK App, the construct is missing the fileSystemArn property.
Use Case
When trying to grant permissions to a FileSystem, we have to build the fileSystem the policy and the arn manually.
const customStack = new Stack(app);
const customVpc = new ec2.Vpc(customStack, 'VPC');
const fs = new FileSystem(customVpc, 'EfsFileSystem', {
vpc: customVpc,
});
new iam.PolicyStatement({
actions: ['elasticfilesystem:ClientWrite'],
resources: [Stack.of(scope).formatArn({
service: 'elasticfilesystem',
resource: 'file-system',
resourceName: fs.fileSystemId,
})],
});
That would become
const customStack = new Stack(app);
const customVpc = new ec2.Vpc(customStack, 'VPC');
const fs = new FileSystem(customVpc, 'EfsFileSystem', {
vpc: customVpc,
});
fs.grant(grantee, 'elasticfilesystem:ClientWrite');
Proposed Solution
Add a fileSystemArn attribute to the construct.
Allow import using arn.
Add a grant method.
This is a 🚀 Feature Request
When creating or importing a File System in a CDK App, the construct is missing the
fileSystemArnproperty.Use Case
When trying to grant permissions to a FileSystem, we have to build the fileSystem the policy and the arn manually.
That would become
Proposed Solution
Add a
fileSystemArnattribute to the construct.Allow import using arn.
Add a grant method.
This is a 🚀 Feature Request