Skip to content

Commit 406dc8e

Browse files
abelmokademmergify[bot]
authored andcommitted
feat(autoscaling): let AutoScalingGroup be IGrantable (#4654)
* feat(autoscaling): let AutoScalingGroup be IGrantable * feat(autoscaling): let AutoScalingGroup be IGrantable
1 parent c0c0513 commit 406dc8e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements
348348
elb.ILoadBalancerTarget,
349349
ec2.IConnectable,
350350
elbv2.IApplicationLoadBalancerTarget,
351-
elbv2.INetworkLoadBalancerTarget {
351+
elbv2.INetworkLoadBalancerTarget,
352+
iam.IGrantable {
352353

353354
public static fromAutoScalingGroupName(scope: Construct, id: string, autoScalingGroupName: string): IAutoScalingGroup {
354355
class Import extends AutoScalingGroupBase {
@@ -378,6 +379,11 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements
378379
*/
379380
public readonly role: iam.IRole;
380381

382+
/**
383+
* The principal to grant permissions to
384+
*/
385+
public readonly grantPrincipal: iam.IPrincipal;
386+
381387
/**
382388
* Name of the AutoScalingGroup
383389
*/
@@ -421,6 +427,8 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements
421427
assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com')
422428
});
423429

430+
this.grantPrincipal = this.role;
431+
424432
const iamProfile = new iam.CfnInstanceProfile(this, 'InstanceProfile', {
425433
roles: [ this.role.roleName ]
426434
});

0 commit comments

Comments
 (0)