Skip to content

Commit f9af47f

Browse files
authored
fix(efs): support tagging for access point (#24336)
Closes #20743 . ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [X] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [X] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 7ad8bc0 commit f9af47f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+875
-159
lines changed

packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.js.snapshot/BatchWithEFSTestDefaultTestDeployAssert0F887B55.assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "21.0.0",
2+
"version": "30.1.0",
33
"files": {
44
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
55
"source": {

packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.js.snapshot/batch-stack.assets.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"version": "21.0.0",
2+
"version": "30.1.0",
33
"files": {
4-
"742f32336d22265973f0e225f7f35f8254d591f606eb0b3fbbc4ffbe4909a323": {
4+
"dea8441064e2b7f93a29d086bcfc92bbdd9b163aed56cc08208f3ec941e96441": {
55
"source": {
66
"path": "batch-stack.template.json",
77
"packaging": "file"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "742f32336d22265973f0e225f7f35f8254d591f606eb0b3fbbc4ffbe4909a323.json",
12+
"objectKey": "dea8441064e2b7f93a29d086bcfc92bbdd9b163aed56cc08208f3ec941e96441.json",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}

packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.js.snapshot/batch-stack.template.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,12 @@
577577
"FileSystemId": {
578578
"Ref": "EFSF3301CFD"
579579
},
580+
"AccessPointTags": [
581+
{
582+
"Key": "Name",
583+
"Value": "batch-stack/EFSAccessPoint"
584+
}
585+
],
580586
"PosixUser": {
581587
"Gid": "1000",
582588
"Uid": "1000"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"20.0.0"}
1+
{"version":"30.1.0"}

packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.js.snapshot/integ.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "21.0.0",
2+
"version": "30.1.0",
33
"testCases": {
44
"BatchWithEFSTest/DefaultTest": {
55
"stacks": [

packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.js.snapshot/manifest.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
{
2-
"version": "21.0.0",
2+
"version": "30.1.0",
33
"artifacts": {
4-
"Tree": {
5-
"type": "cdk:tree",
6-
"properties": {
7-
"file": "tree.json"
8-
}
9-
},
104
"batch-stack.assets": {
115
"type": "cdk:asset-manifest",
126
"properties": {
@@ -23,7 +17,7 @@
2317
"validateOnSynth": false,
2418
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
2519
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
26-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/742f32336d22265973f0e225f7f35f8254d591f606eb0b3fbbc4ffbe4909a323.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dea8441064e2b7f93a29d086bcfc92bbdd9b163aed56cc08208f3ec941e96441.json",
2721
"requiresBootstrapStackVersion": 6,
2822
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2923
"additionalDependencies": [
@@ -490,6 +484,12 @@
490484
]
491485
},
492486
"displayName": "BatchWithEFSTest/DefaultTest/DeployAssert"
487+
},
488+
"Tree": {
489+
"type": "cdk:tree",
490+
"properties": {
491+
"file": "tree.json"
492+
}
493493
}
494494
}
495495
}

packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.js.snapshot/tree.json

Lines changed: 129 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
"id": "App",
55
"path": "",
66
"children": {
7-
"Tree": {
8-
"id": "Tree",
9-
"path": "Tree",
10-
"constructInfo": {
11-
"fqn": "constructs.Construct",
12-
"version": "10.1.140"
13-
}
14-
},
157
"batch-stack": {
168
"id": "batch-stack",
179
"path": "batch-stack",
@@ -942,6 +934,12 @@
942934
"fileSystemId": {
943935
"Ref": "EFSF3301CFD"
944936
},
937+
"accessPointTags": [
938+
{
939+
"key": "Name",
940+
"value": "batch-stack/EFSAccessPoint"
941+
}
942+
],
945943
"posixUser": {
946944
"uid": "1000",
947945
"gid": "1000"
@@ -970,6 +968,14 @@
970968
"id": "DefaultJobRole",
971969
"path": "batch-stack/DefaultJobRole",
972970
"children": {
971+
"ImportDefaultJobRole": {
972+
"id": "ImportDefaultJobRole",
973+
"path": "batch-stack/DefaultJobRole/ImportDefaultJobRole",
974+
"constructInfo": {
975+
"fqn": "@aws-cdk/core.Resource",
976+
"version": "0.0.0"
977+
}
978+
},
973979
"Resource": {
974980
"id": "Resource",
975981
"path": "batch-stack/DefaultJobRole/Resource",
@@ -1132,6 +1138,14 @@
11321138
"id": "Ecs-Instance-Role",
11331139
"path": "batch-stack/batch-demand-compute-env-launch-template/Ecs-Instance-Role",
11341140
"children": {
1141+
"ImportEcs-Instance-Role": {
1142+
"id": "ImportEcs-Instance-Role",
1143+
"path": "batch-stack/batch-demand-compute-env-launch-template/Ecs-Instance-Role/ImportEcs-Instance-Role",
1144+
"constructInfo": {
1145+
"fqn": "@aws-cdk/core.Resource",
1146+
"version": "0.0.0"
1147+
}
1148+
},
11351149
"Resource": {
11361150
"id": "Resource",
11371151
"path": "batch-stack/batch-demand-compute-env-launch-template/Ecs-Instance-Role/Resource",
@@ -1199,6 +1213,14 @@
11991213
"id": "Resource-Service-Instance-Role",
12001214
"path": "batch-stack/batch-demand-compute-env-launch-template/Resource-Service-Instance-Role",
12011215
"children": {
1216+
"ImportResource-Service-Instance-Role": {
1217+
"id": "ImportResource-Service-Instance-Role",
1218+
"path": "batch-stack/batch-demand-compute-env-launch-template/Resource-Service-Instance-Role/ImportResource-Service-Instance-Role",
1219+
"constructInfo": {
1220+
"fqn": "@aws-cdk/core.Resource",
1221+
"version": "0.0.0"
1222+
}
1223+
},
12021224
"Resource": {
12031225
"id": "Resource",
12041226
"path": "batch-stack/batch-demand-compute-env-launch-template/Resource-Service-Instance-Role/Resource",
@@ -1358,6 +1380,14 @@
13581380
"id": "Ecs-Instance-Role",
13591381
"path": "batch-stack/batch-spot-compute-env/Ecs-Instance-Role",
13601382
"children": {
1383+
"ImportEcs-Instance-Role": {
1384+
"id": "ImportEcs-Instance-Role",
1385+
"path": "batch-stack/batch-spot-compute-env/Ecs-Instance-Role/ImportEcs-Instance-Role",
1386+
"constructInfo": {
1387+
"fqn": "@aws-cdk/core.Resource",
1388+
"version": "0.0.0"
1389+
}
1390+
},
13611391
"Resource": {
13621392
"id": "Resource",
13631393
"path": "batch-stack/batch-spot-compute-env/Ecs-Instance-Role/Resource",
@@ -1425,6 +1455,14 @@
14251455
"id": "Resource-Service-Instance-Role",
14261456
"path": "batch-stack/batch-spot-compute-env/Resource-Service-Instance-Role",
14271457
"children": {
1458+
"ImportResource-Service-Instance-Role": {
1459+
"id": "ImportResource-Service-Instance-Role",
1460+
"path": "batch-stack/batch-spot-compute-env/Resource-Service-Instance-Role/ImportResource-Service-Instance-Role",
1461+
"constructInfo": {
1462+
"fqn": "@aws-cdk/core.Resource",
1463+
"version": "0.0.0"
1464+
}
1465+
},
14281466
"Resource": {
14291467
"id": "Resource",
14301468
"path": "batch-stack/batch-spot-compute-env/Resource-Service-Instance-Role/Resource",
@@ -1587,6 +1625,14 @@
15871625
"id": "Ecs-Instance-Role",
15881626
"path": "batch-stack/batch-demand-compute-env-launch-template-2/Ecs-Instance-Role",
15891627
"children": {
1628+
"ImportEcs-Instance-Role": {
1629+
"id": "ImportEcs-Instance-Role",
1630+
"path": "batch-stack/batch-demand-compute-env-launch-template-2/Ecs-Instance-Role/ImportEcs-Instance-Role",
1631+
"constructInfo": {
1632+
"fqn": "@aws-cdk/core.Resource",
1633+
"version": "0.0.0"
1634+
}
1635+
},
15901636
"Resource": {
15911637
"id": "Resource",
15921638
"path": "batch-stack/batch-demand-compute-env-launch-template-2/Ecs-Instance-Role/Resource",
@@ -1654,6 +1700,14 @@
16541700
"id": "Resource-Service-Instance-Role",
16551701
"path": "batch-stack/batch-demand-compute-env-launch-template-2/Resource-Service-Instance-Role",
16561702
"children": {
1703+
"ImportResource-Service-Instance-Role": {
1704+
"id": "ImportResource-Service-Instance-Role",
1705+
"path": "batch-stack/batch-demand-compute-env-launch-template-2/Resource-Service-Instance-Role/ImportResource-Service-Instance-Role",
1706+
"constructInfo": {
1707+
"fqn": "@aws-cdk/core.Resource",
1708+
"version": "0.0.0"
1709+
}
1710+
},
16571711
"Resource": {
16581712
"id": "Resource",
16591713
"path": "batch-stack/batch-demand-compute-env-launch-template-2/Resource-Service-Instance-Role/Resource",
@@ -1852,6 +1906,14 @@
18521906
"id": "Resource-Service-Instance-Role",
18531907
"path": "batch-stack/batch-fargate-compute-env/Resource-Service-Instance-Role",
18541908
"children": {
1909+
"ImportResource-Service-Instance-Role": {
1910+
"id": "ImportResource-Service-Instance-Role",
1911+
"path": "batch-stack/batch-fargate-compute-env/Resource-Service-Instance-Role/ImportResource-Service-Instance-Role",
1912+
"constructInfo": {
1913+
"fqn": "@aws-cdk/core.Resource",
1914+
"version": "0.0.0"
1915+
}
1916+
},
18551917
"Resource": {
18561918
"id": "Resource",
18571919
"path": "batch-stack/batch-fargate-compute-env/Resource-Service-Instance-Role/Resource",
@@ -1986,6 +2048,14 @@
19862048
"id": "Resource-Service-Instance-Role",
19872049
"path": "batch-stack/batch-fargate-spot-compute-env/Resource-Service-Instance-Role",
19882050
"children": {
2051+
"ImportResource-Service-Instance-Role": {
2052+
"id": "ImportResource-Service-Instance-Role",
2053+
"path": "batch-stack/batch-fargate-spot-compute-env/Resource-Service-Instance-Role/ImportResource-Service-Instance-Role",
2054+
"constructInfo": {
2055+
"fqn": "@aws-cdk/core.Resource",
2056+
"version": "0.0.0"
2057+
}
2058+
},
19892059
"Resource": {
19902060
"id": "Resource",
19912061
"path": "batch-stack/batch-fargate-spot-compute-env/Resource-Service-Instance-Role/Resource",
@@ -2313,6 +2383,14 @@
23132383
"id": "execution-role",
23142384
"path": "batch-stack/execution-role",
23152385
"children": {
2386+
"Importexecution-role": {
2387+
"id": "Importexecution-role",
2388+
"path": "batch-stack/execution-role/Importexecution-role",
2389+
"constructInfo": {
2390+
"fqn": "@aws-cdk/core.Resource",
2391+
"version": "0.0.0"
2392+
}
2393+
},
23162394
"Resource": {
23172395
"id": "Resource",
23182396
"path": "batch-stack/execution-role/Resource",
@@ -2502,6 +2580,22 @@
25022580
"fqn": "@aws-cdk/aws-batch.JobDefinition",
25032581
"version": "0.0.0"
25042582
}
2583+
},
2584+
"BootstrapVersion": {
2585+
"id": "BootstrapVersion",
2586+
"path": "batch-stack/BootstrapVersion",
2587+
"constructInfo": {
2588+
"fqn": "@aws-cdk/core.CfnParameter",
2589+
"version": "0.0.0"
2590+
}
2591+
},
2592+
"CheckBootstrapVersion": {
2593+
"id": "CheckBootstrapVersion",
2594+
"path": "batch-stack/CheckBootstrapVersion",
2595+
"constructInfo": {
2596+
"fqn": "@aws-cdk/core.CfnRule",
2597+
"version": "0.0.0"
2598+
}
25052599
}
25062600
},
25072601
"constructInfo": {
@@ -2522,12 +2616,30 @@
25222616
"path": "BatchWithEFSTest/DefaultTest/Default",
25232617
"constructInfo": {
25242618
"fqn": "constructs.Construct",
2525-
"version": "10.1.140"
2619+
"version": "10.1.252"
25262620
}
25272621
},
25282622
"DeployAssert": {
25292623
"id": "DeployAssert",
25302624
"path": "BatchWithEFSTest/DefaultTest/DeployAssert",
2625+
"children": {
2626+
"BootstrapVersion": {
2627+
"id": "BootstrapVersion",
2628+
"path": "BatchWithEFSTest/DefaultTest/DeployAssert/BootstrapVersion",
2629+
"constructInfo": {
2630+
"fqn": "@aws-cdk/core.CfnParameter",
2631+
"version": "0.0.0"
2632+
}
2633+
},
2634+
"CheckBootstrapVersion": {
2635+
"id": "CheckBootstrapVersion",
2636+
"path": "BatchWithEFSTest/DefaultTest/DeployAssert/CheckBootstrapVersion",
2637+
"constructInfo": {
2638+
"fqn": "@aws-cdk/core.CfnRule",
2639+
"version": "0.0.0"
2640+
}
2641+
}
2642+
},
25312643
"constructInfo": {
25322644
"fqn": "@aws-cdk/core.Stack",
25332645
"version": "0.0.0"
@@ -2544,6 +2656,14 @@
25442656
"fqn": "@aws-cdk/integ-tests.IntegTest",
25452657
"version": "0.0.0"
25462658
}
2659+
},
2660+
"Tree": {
2661+
"id": "Tree",
2662+
"path": "Tree",
2663+
"constructInfo": {
2664+
"fqn": "constructs.Construct",
2665+
"version": "10.1.252"
2666+
}
25472667
}
25482668
},
25492669
"constructInfo": {

packages/@aws-cdk/aws-efs/lib/access-point.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ArnFormat, IResource, Resource, Stack } from '@aws-cdk/core';
1+
import { ArnFormat, IResource, Resource, Stack, Tags } from '@aws-cdk/core';
22
import { Construct } from 'constructs';
33
import { IFileSystem } from './efs-file-system';
44
import { CfnAccessPoint } from './efs.generated';
@@ -218,6 +218,8 @@ export class AccessPoint extends AccessPointBase {
218218
} : undefined,
219219
});
220220

221+
Tags.of(this).add('Name', this.node.path);
222+
221223
this.accessPointId = resource.ref;
222224
this.accessPointArn = Stack.of(scope).formatArn({
223225
service: 'elasticfilesystem',

packages/@aws-cdk/aws-efs/test/access-point.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Template } from '@aws-cdk/assertions';
22
import * as ec2 from '@aws-cdk/aws-ec2';
3-
import { Stack } from '@aws-cdk/core';
3+
import { Stack, Tags } from '@aws-cdk/core';
44
import { AccessPoint, FileSystem } from '../lib';
55

66
let stack: Stack;
@@ -31,6 +31,25 @@ test('new AccessPoint correctly', () => {
3131
Template.fromStack(stack).resourceCountIs('AWS::EFS::AccessPoint', 1);
3232
});
3333

34+
test('support tags for AccessPoint', () => {
35+
// WHEN
36+
const accessPoint = new AccessPoint(stack, 'MyAccessPoint', {
37+
fileSystem,
38+
});
39+
Tags.of(accessPoint).add('key1', 'value1');
40+
Tags.of(accessPoint).add('key2', 'value2');
41+
Tags.of(accessPoint).add('Name', 'MyAccessPointName');
42+
43+
// THEN
44+
Template.fromStack(stack).hasResourceProperties('AWS::EFS::AccessPoint', {
45+
AccessPointTags: [
46+
{ Key: 'key1', Value: 'value1' },
47+
{ Key: 'key2', Value: 'value2' },
48+
{ Key: 'Name', Value: 'MyAccessPointName' },
49+
],
50+
});
51+
});
52+
3453
test('import an AccessPoint using fromAccessPointId', () => {
3554
// WHEN
3655
const ap = new AccessPoint(stack, 'MyAccessPoint', {

packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/FileSystemPolicyTestDefaultTestDeployAssertD0596FC1.assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "30.0.0",
2+
"version": "30.1.0",
33
"files": {
44
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
55
"source": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"30.0.0"}
1+
{"version":"30.1.0"}

0 commit comments

Comments
 (0)