aws-cdk-lib.aws_iam.FromRoleNameOptions

interface FromRoleNameOptions

LanguageType name
.NETAmazon.CDK.AWS.IAM.FromRoleNameOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsiam#FromRoleNameOptions
Javasoftware.amazon.awscdk.services.iam.FromRoleNameOptions
Pythonaws_cdk.aws_iam.FromRoleNameOptions
TypeScript (source)aws-cdk-lib » aws_iam » FromRoleNameOptions

Options allowing customizing the behavior of Role.fromRoleName.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iam as iam } from 'aws-cdk-lib';
const fromRoleNameOptions: iam.FromRoleNameOptions = {
  addGrantsToResources: false,
  defaultPolicyName: 'defaultPolicyName',
  mutable: false,
};

Properties

NameTypeDescription
addGrantsToResources?booleanFor immutable roles: add grants to resources instead of dropping them.
defaultPolicyName?stringAny policies created by this role will use this value as their ID, if specified.
mutable?booleanWhether the imported role can be modified by attaching policy resources to it.

addGrantsToResources?

Type: boolean (optional, default: false)

For immutable roles: add grants to resources instead of dropping them.

If this is false or not specified, grant permissions added to this role are ignored. It is your own responsibility to make sure the role has the required permissions.

If this is true, any grant permissions will be added to the resource instead.


defaultPolicyName?

Type: string (optional, default: 'Policy')

Any policies created by this role will use this value as their ID, if specified.

Specify this if importing the same role in multiple stacks, and granting it different permissions in at least two stacks. If this is not specified (or if the same name is specified in more than one stack), a CloudFormation issue will result in the policy created in whichever stack is deployed last overwriting the policies created by the others.


mutable?

Type: boolean (optional, default: true)

Whether the imported role can be modified by attaching policy resources to it.