Anyone know how I can add a `applyRemovalPolicy(cd...
# help
d
Anyone know how I can add a
applyRemovalPolicy(cdk.RemovalPolicy.RETAIN)
to inline policies on a role?
Copy code
roleCleanup.addToPolicy(
      new iam.PolicyStatement({
        effect: iam.Effect.ALLOW,
        actions: ['events:DeleteRule'],
        resources: [ cronCleanupArn ],
      }),
    )
the role itself has retain… but noticing that these policies still get removed when the stack is deleted
f
I don’t think it’s possible, it’s not the same “policy”
In CFN template
DeletionPolicy
is a resource property, not a part of the IAM policy statement.
d
I think I figured it out.
Copy code
const permission = lambdaCleanup.permissionsNode.tryFindChild(lambdaPermissionId) as cdk.IResource;
seems to be working