CustomizeRolesOptions Struct
Options for customizing IAM role creation.
Example
ts
declare const app: App;
const stack = new Stack(app, 'MyStack');
iam.Role.customizeRoles(this, {
usePrecreatedRoles: {
'MyStack/MyLambda/ServiceRole': 'my-role-name',
}
});
Properties
preventSynthesisoptionalbooleanprevent_synthesisoptionalboolpreventSynthesisoptionalBooleanPreventSynthesisoptionalboolPreventSynthesisoptional*bool= true#Whether or not to synthesize the resource into the CFN template.
Set this to false if you still want to create the resources and you also want to create the policy report.
usePrecreatedRolesoptional{ [key: string]: string }use_precreated_rolesoptionaltyping.Mapping[str, str]usePrecreatedRolesoptionalMap<String, String>UsePrecreatedRolesoptionalIDictionary<string, string>UsePrecreatedRolesoptional*map[string]*string#A list of precreated IAM roles to substitute for roles that CDK is creating.
Default: there are no precreated roles. Synthesis will fail if preventSynthesis=true
The constructPath can be either a relative or absolute path from the scope that customizeRoles is used on to the role being created.
example
ts
declare const app: App;
const stack = new Stack(app, 'MyStack');
new iam.Role(stack, 'MyRole', {
assumedBy: new iam.AccountPrincipal('111111111111'),
});
iam.Role.customizeRoles(stack, {
usePrecreatedRoles: {
// absolute path
'MyStack/MyRole': 'my-precreated-role-name',
// or relative path from `stack`
'MyRole': 'my-precreated-role',
},
});