Skip to content

Commit f76ee2e

Browse files
authored
Support IAM Permissions Boundaries
1 parent 374bcc5 commit f76ee2e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

templates/aws-stack.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ Parameters:
299299
Description: Optional - A name for the IAM Role attached to the Instance Profile
300300
Default: ""
301301

302+
InstanceRolePermissionsBoundaryARN:
303+
Type: String
304+
Description: The ARN of the policy used to set the permissions boundary for the role.
305+
Default: ""
306+
302307
InstanceOperatingSystem:
303308
Type: String
304309
Description: The operating system to run on the instances
@@ -436,6 +441,9 @@ Conditions:
436441
SetInstanceRoleName:
437442
!Not [ !Equals [ !Ref InstanceRoleName, "" ] ]
438443

444+
SetInstanceRolePermissionsBoundaryARN:
445+
!Not [ !Equals [ !Ref InstanceRolePermissionsBoundaryARN, "" ] ]
446+
439447
UseSpecifiedSecretsBucket:
440448
!Not [ !Equals [ !Ref SecretsBucket, "" ] ]
441449

@@ -635,6 +643,7 @@ Resources:
635643
Type: AWS::IAM::Role
636644
Properties:
637645
RoleName: !If [ SetInstanceRoleName, !Ref InstanceRoleName, !Sub "${AWS::StackName}-Role" ]
646+
PermissionsBoundary: !If [ SetInstanceRolePermissionsBoundaryARN, !Ref InstanceRolePermissionsBoundaryARN ]
638647
ManagedPolicyArns: !If
639648
- HasManagedPolicies
640649
# Support multiple policies to attach by merging the values together and splitting on ','
@@ -975,6 +984,7 @@ Resources:
975984
AsgProcessSuspenderRole:
976985
Type: AWS::IAM::Role
977986
Properties:
987+
PermissionsBoundary: !If [ SetInstanceRolePermissionsBoundaryARN, !Ref InstanceRolePermissionsBoundaryARN ]
978988
AssumeRolePolicyDocument:
979989
Version: 2012-10-17
980990
Statement:
@@ -1051,6 +1061,7 @@ Resources:
10511061
Type: AWS::IAM::Role
10521062
Condition: HasVariableSize
10531063
Properties:
1064+
PermissionsBoundary: !If [ SetInstanceRolePermissionsBoundaryARN, !Ref InstanceRolePermissionsBoundaryARN ]
10541065
Path: "/"
10551066
AssumeRolePolicyDocument:
10561067
Version: '2012-10-17'

0 commit comments

Comments
 (0)