Skip to content

Commit 87e1add

Browse files
authored
chore(cognito-identitypool): make role attachment resource public (#34234)
### Issue # (if applicable) N/A ### Reason for this change In order to allow for more flexibility when configuring Identity Pool resources, one may need to override attributes in the role attachment. To make this process easier, we should be able to access this resource the same way as we would access the L2 resource. ### Description of changes ```ts // private readonly roleAttachment: IdentityPoolRoleAttachment; public readonly roleAttachment: IdentityPoolRoleAttachment; ``` ### Describe any new or updated permissions being added N/A ### Description of how you validated changes `yarn build && yarn test aws-cognito-identitypool` ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 9e3cbf6 commit 87e1add

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ export class IdentityPool extends Resource implements IIdentityPool {
440440
/**
441441
* Role Provider for the default Role for authenticated users
442442
*/
443-
private readonly roleAttachment: IdentityPoolRoleAttachment;
443+
public readonly roleAttachment: CfnIdentityPoolRoleAttachment;
444444

445445
/**
446446
* List of Identity Providers added in constructor for use with property overrides
@@ -500,7 +500,7 @@ export class IdentityPool extends Resource implements IIdentityPool {
500500
authenticatedRole: this.authenticatedRole,
501501
unauthenticatedRole: this.unauthenticatedRole,
502502
roleMappings: props.roleMappings,
503-
});
503+
}).resource;
504504

505505
Array.isArray(this.roleAttachment);
506506
}
@@ -589,6 +589,11 @@ class IdentityPoolRoleAttachment extends Resource implements IIdentityPoolRoleAt
589589
*/
590590
public readonly identityPoolId: string;
591591

592+
/**
593+
* The Identity Pool Role Attachment CFN resource.
594+
*/
595+
public readonly resource: CfnIdentityPoolRoleAttachment;
596+
592597
constructor(scope: Construct, id: string, props: IdentityPoolRoleAttachmentProps) {
593598
super(scope, id);
594599
// Enhanced CDK Analytics Telemetry
@@ -604,7 +609,7 @@ class IdentityPoolRoleAttachment extends Resource implements IIdentityPoolRoleAt
604609
if (mappings) {
605610
roleMappings = this.configureRoleMappings(...mappings);
606611
}
607-
new CfnIdentityPoolRoleAttachment(this, 'Resource', {
612+
this.resource = new CfnIdentityPoolRoleAttachment(this, 'Resource', {
608613
identityPoolId: this.identityPoolId,
609614
roles,
610615
roleMappings,

0 commit comments

Comments
 (0)