Skip to content

aws-iam: Make setting trust on roles more clear in overview and function descriptions #22550

@sean-beath

Description

@sean-beath

Describe the bug

When running the grant_assume_role on a role with a Service Principle as the input, the role's trust policy is not updated.

Expected Behavior

I expect the role's trust policy to be updated.

Current Behavior

Nothing happens. If I change the Service Principle in the function and run a cdk diff, there is no difference in deployment suggesting the function is not doing anything.

Reproduction Steps

In Python:

        # Create new IAM role for DMS access to Redshift
        dmsRedshiftRole = iam.Role(self, "dmsRedshiftRole",
            assumed_by=iam.ServicePrincipal(
                "dms.{}.amazonaws.com".format(self.region)),
            description="IAM role to be used by DMS for access to Redshift",
            managed_policies=[iam.ManagedPolicy.from_aws_managed_policy_name(
                "service-role/AmazonDMSRedshiftS3Role")],
        )

        # Allow DMS role to be assumed by Redshift.
        dmsRedshiftRole.grant_assume_role(iam.ServicePrincipal("redshift.amazonaws.com"))

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.43.1

Framework Version

No response

Node.js Version

8.5.4

OS

Mac Monterey 12.5

Language

Python

Language Version

3.9.14

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-iamRelated to AWS Identity and Access ManagementbugThis issue is a bug.documentationThis is a problem with documentation.effort/smallSmall work item – less than a day of effortp1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions