Describe the bug
If I accidentally from from_role_name using an role ARN like the code below.
role_arn = "arn:aws:iam::***:role/myrole"
role = iam.Role.from_role_name(
scope=self,
id="Role",
role_name=role_arn,
)
print(role.role_arn)
The function does not report any error and returns a valid role object with wrong ARN. The snippet will print
arn:aws:iam::***:role/arn:aws:iam::***:role/myrole
which of course is a invalid arn and cannot be used anywhere.
Expected Behavior
Either
throw an exception such as "Role not found" or "Invalid Role Name"
OR
Return the correct role as it does, but with its attributes having valid values.
Current Behavior
The function is returning an object with wrong ARN and not failing as expected.
Reproduction Steps
Just include the above code in a CDK stack.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.67.0 (build b6f7f39)
Framework Version
No response
Node.js Version
v14.21.3
OS
Amazon Linux 2
Language
Python
Language Version
Python 3.9.13
Other information
No response
Describe the bug
If I accidentally from
from_role_nameusing an role ARN like the code below.The function does not report any error and returns a valid role object with wrong ARN. The snippet will print
arn:aws:iam::***:role/arn:aws:iam::***:role/myrolewhich of course is a invalid arn and cannot be used anywhere.
Expected Behavior
Either
throw an exception such as "Role not found" or "Invalid Role Name"
OR
Return the correct role as it does, but with its attributes having valid values.
Current Behavior
The function is returning an object with wrong ARN and not failing as expected.
Reproduction Steps
Just include the above code in a CDK stack.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.67.0 (build b6f7f39)
Framework Version
No response
Node.js Version
v14.21.3
OS
Amazon Linux 2
Language
Python
Language Version
Python 3.9.13
Other information
No response