Skip to content

Commit

Permalink
Create IAM user for install and add permissions to default role
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Hocutt <[email protected]>
  • Loading branch information
jaredhocutt committed Sep 29, 2023
1 parent 910ad75 commit e51f38d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions hack/cloudformation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ Resources:

DefaultInstanceRole:
Type: AWS::IAM::Role
DependsOn: InstallIamUser
Properties:
RoleName: !Sub ${AWS::StackName}-default-role
AssumeRolePolicyDocument:
Expand Down Expand Up @@ -324,9 +325,15 @@ Resources:
- - "arn:aws:s3:::"
- !If [GenerateS3BucketName, !Sub "ocp4-disconnected-${AWS::AccountId}-${AWS::Region}", !Ref S3TransferBucketName]
- "/*"
- Effect: Allow
Action:
- iam:CreateAccessKey
Resource:
- !GetAtt InstallIamUser.Arn
- Effect: Allow
Action:
- cloudformation:DescribeStacks
- ec2:DescribeSubnets
Resource: "*"

DefaultInstanceProfile:
Expand All @@ -337,6 +344,19 @@ Resources:
Roles:
- !Ref DefaultInstanceRole

InstallIamUser:
Type: AWS::IAM::User
Properties:
UserName: !Sub ${AWS::StackName}-install-user
Policies:
- PolicyName: AdministratorAccess
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action: "*"
Resource: "*"

#############################################################################
# NAT Instance
#############################################################################
Expand Down Expand Up @@ -732,3 +752,7 @@ Outputs:
HighSideInstancePrivateIp:
Description: A reference to the private IP to the High Side instance
Value: !GetAtt HighSideInstance.PrivateIp

InstallIamUser:
Description: A reference to the IAM User to use for installing OpenShift
Value: !Ref InstallIamUser

0 comments on commit e51f38d

Please sign in to comment.