Open
Description
Describe the bug
Trying to create a trust-policy for a given role, like this:
cannot be created with CDK.
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
CDK Version: 2.1002.0 (build 09ef5a0)
Expected Behavior
the trust-policy for a given role, will contain the given statements
Current Behavior
the trust-policy will not be included in the role.
Reproduction Steps
try this code:
let servicePrincipal = new iam.ServicePrincipal('access-grants.s3.amazonaws.com');
servicePrincipal.addToAssumeRolePolicy(trustPolicy);
servicePrincipal.addToPolicy(new iam.PolicyStatement({
sid: 'AccessGrantsTrustPolicy',
effect: iam.Effect.ALLOW,
principals: [new iam.ServicePrincipal('access-grants.s3.amazonaws.com')],
actions: ['sts:AssumeRole', 'sts:SetSourceIdentity'],
conditions: {
StringEquals: {
'aws:SourceAccount': '9xxx2',
'aws:SourceArn': 'arn:aws:s3:eu-central-1:9xxx2:access-grants/default',
},
},
}));
this.context.properties.accessGrantsRole = new iam.Role(this, this.id4res('AccessGrantsRole'), {
assumedBy: servicePrincipal,
inlinePolicies: {
'AccessGrantsPolicy': accessGrantsPolicy,
},
});
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
CDK Version: 2.1002.0 (build 09ef5a0)
Framework Version
No response
Node.js Version
Node.js v22.12.0
OS
Win11
Language
TypeScript
Language Version
No response
Other information
No response