FromRoleNameOptions

class aws_cdk.aws_iam.FromRoleNameOptions(*, add_grants_to_resources=None, default_policy_name=None, mutable=None)

Bases: FromRoleArnOptions

Options allowing customizing the behavior of Role.fromRoleName.

Parameters:
  • add_grants_to_resources (Optional[bool]) – 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. Default: false

  • default_policy_name (Optional[str]) – 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. Default: ‘Policy’

  • mutable (Optional[bool]) – Whether the imported role can be modified by attaching policy resources to it. Default: true

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_iam as iam

from_role_name_options = iam.FromRoleNameOptions(
    add_grants_to_resources=False,
    default_policy_name="defaultPolicyName",
    mutable=False
)

Attributes

add_grants_to_resources

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.

Default:

false

Type:

For immutable roles

default_policy_name

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.

Default:

‘Policy’

mutable

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

Default:

true