Skip to content

Commit 45aee86

Browse files
author
James Healy
authored
Merge pull request #805 from nitrocode/iampermboundary
Add missing else condition to iam permission boundary
2 parents 5ba33e8 + e8c8b0a commit 45aee86

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
@@ -308,6 +308,11 @@ Parameters:
308308
Description: Optional - A name for the IAM Role attached to the Instance Profile
309309
Default: ""
310310

311+
InstanceRolePermissionsBoundaryARN:
312+
Type: String
313+
Description: The ARN of the policy used to set the permissions boundary for the role.
314+
Default: ""
315+
311316
InstanceOperatingSystem:
312317
Type: String
313318
Description: The operating system to run on the instances
@@ -445,6 +450,9 @@ Conditions:
445450
SetInstanceRoleName:
446451
!Not [ !Equals [ !Ref InstanceRoleName, "" ] ]
447452

453+
SetInstanceRolePermissionsBoundaryARN:
454+
!Not [ !Equals [ !Ref InstanceRolePermissionsBoundaryARN, "" ] ]
455+
448456
UseSpecifiedSecretsBucket:
449457
!Not [ !Equals [ !Ref SecretsBucket, "" ] ]
450458

@@ -656,6 +664,7 @@ Resources:
656664
Type: AWS::IAM::Role
657665
Properties:
658666
RoleName: !If [ SetInstanceRoleName, !Ref InstanceRoleName, !Sub "${AWS::StackName}-Role" ]
667+
PermissionsBoundary: !If [ SetInstanceRolePermissionsBoundaryARN, !Ref InstanceRolePermissionsBoundaryARN, !Ref "AWS::NoValue" ]
659668
ManagedPolicyArns: !If
660669
- HasManagedPolicies
661670
# Support multiple policies to attach by merging the values together and splitting on ','
@@ -1019,6 +1028,7 @@ Resources:
10191028
AsgProcessSuspenderRole:
10201029
Type: AWS::IAM::Role
10211030
Properties:
1031+
PermissionsBoundary: !If [ SetInstanceRolePermissionsBoundaryARN, !Ref InstanceRolePermissionsBoundaryARN, !Ref "AWS::NoValue" ]
10221032
AssumeRolePolicyDocument:
10231033
Version: 2012-10-17
10241034
Statement:
@@ -1095,6 +1105,7 @@ Resources:
10951105
Type: AWS::IAM::Role
10961106
Condition: HasVariableSize
10971107
Properties:
1108+
PermissionsBoundary: !If [ SetInstanceRolePermissionsBoundaryARN, !Ref InstanceRolePermissionsBoundaryARN, !Ref "AWS::NoValue" ]
10981109
Path: "/"
10991110
AssumeRolePolicyDocument:
11001111
Version: '2012-10-17'

0 commit comments

Comments
 (0)