From b955301b131b9e51fdc8d1600ff982b6bc850d9e Mon Sep 17 00:00:00 2001 From: Leonardo Gama Date: Wed, 23 Apr 2025 14:22:06 -0700 Subject: [PATCH 1/2] Publicize role attachment --- .../aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts b/packages/aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts index a760c1c442932..d8e9befe85d86 100644 --- a/packages/aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts +++ b/packages/aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts @@ -440,7 +440,7 @@ export class IdentityPool extends Resource implements IIdentityPool { /** * Role Provider for the default Role for authenticated users */ - private readonly roleAttachment: IdentityPoolRoleAttachment; + public readonly roleAttachment: IdentityPoolRoleAttachment; /** * List of Identity Providers added in constructor for use with property overrides From 4e2ffce668d42a1d3407b105de132af18d86a7a8 Mon Sep 17 00:00:00 2001 From: Leonardo Gama Date: Wed, 23 Apr 2025 15:00:52 -0700 Subject: [PATCH 2/2] Let it set to CFN instead of intermediary class --- .../aws-cognito-identitypool/lib/identitypool.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts b/packages/aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts index d8e9befe85d86..6ba6cde6d9650 100644 --- a/packages/aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts +++ b/packages/aws-cdk-lib/aws-cognito-identitypool/lib/identitypool.ts @@ -440,7 +440,7 @@ export class IdentityPool extends Resource implements IIdentityPool { /** * Role Provider for the default Role for authenticated users */ - public readonly roleAttachment: IdentityPoolRoleAttachment; + public readonly roleAttachment: CfnIdentityPoolRoleAttachment; /** * List of Identity Providers added in constructor for use with property overrides @@ -500,7 +500,7 @@ export class IdentityPool extends Resource implements IIdentityPool { authenticatedRole: this.authenticatedRole, unauthenticatedRole: this.unauthenticatedRole, roleMappings: props.roleMappings, - }); + }).resource; Array.isArray(this.roleAttachment); } @@ -589,6 +589,11 @@ class IdentityPoolRoleAttachment extends Resource implements IIdentityPoolRoleAt */ public readonly identityPoolId: string; + /** + * The Identity Pool Role Attachment CFN resource. + */ + public readonly resource: CfnIdentityPoolRoleAttachment; + constructor(scope: Construct, id: string, props: IdentityPoolRoleAttachmentProps) { super(scope, id); // Enhanced CDK Analytics Telemetry @@ -604,7 +609,7 @@ class IdentityPoolRoleAttachment extends Resource implements IIdentityPoolRoleAt if (mappings) { roleMappings = this.configureRoleMappings(...mappings); } - new CfnIdentityPoolRoleAttachment(this, 'Resource', { + this.resource = new CfnIdentityPoolRoleAttachment(this, 'Resource', { identityPoolId: this.identityPoolId, roles, roleMappings,