Interface ICustomizeRolesOptions
Options for customizing IAM role creation.
Namespace: Amazon.CDK.AWS.IAM
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface ICustomizeRolesOptions
Syntax (vb)
Public Interface ICustomizeRolesOptions
Remarks
ExampleMetadata: infused
Examples
App app;
var stack = new Stack(app, "MyStack");
Role.CustomizeRoles(this, new CustomizeRolesOptions {
UsePrecreatedRoles = new Dictionary<string, string> {
{ "MyStack/MyLambda/ServiceRole", "my-role-name" }
}
});
Synopsis
Properties
| PreventSynthesis | Whether or not to synthesize the resource into the CFN template. |
| UsePrecreatedRoles | A list of precreated IAM roles to substitute for roles that CDK is creating. |
Properties
PreventSynthesis
Whether or not to synthesize the resource into the CFN template.
bool? PreventSynthesis { get; }
Property Value
bool?
Remarks
Set this to false if you still want to create the resources and
you also want to create the policy report.
Default: true
UsePrecreatedRoles
A list of precreated IAM roles to substitute for roles that CDK is creating.
IDictionary<string, string>? UsePrecreatedRoles { get; }
Property Value
Remarks
The constructPath can be either a relative or absolute path
from the scope that customizeRoles is used on to the role being created.
Default: - there are no precreated roles. Synthesis will fail if preventSynthesis=true
Examples
App app;
var stack = new Stack(app, "MyStack");
new Role(stack, "MyRole", new RoleProps {
AssumedBy = new AccountPrincipal("1111111111")
});
Role.CustomizeRoles(stack, new CustomizeRolesOptions {
UsePrecreatedRoles = new Dictionary<string, string> {
// absolute path
{ "MyStack/MyRole", "my-precreated-role-name" },
// or relative path from `stack`
{ "MyRole", "my-precreated-role" }
}
});