Skip to content

Commit

Permalink
Merge pull request #66 from aaraj7/main
Browse files Browse the repository at this point in the history
OCM-8348 | test: Prepare additional principals role
  • Loading branch information
robpblake authored Jul 15, 2024
2 parents 4c98682 + 906f917 commit 2080f91
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/aws/aws_client/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,22 @@ func (client *AWSClient) CreatePolicyForSharedVPC(policyName string) (string, er
}
return client.CreatePolicy(policyName, statement)
}

func (client *AWSClient) CreateRoleForAdditionalPrincipals(roleName string, installerRoleArn string) (types.Role, error) {
statement := map[string]interface{}{
"Sid": "Statement1",
"Effect": "Allow",
"Principal": map[string]interface{}{
"AWS": []string{installerRoleArn},
},
"Action": "sts:AssumeRole",
}

assumeRolePolicyDocument, err := completeRolePolicyDocument(statement)
if err != nil {
log.LogError("Failed to convert Role Policy Document into JSON: %s", err.Error())
return types.Role{}, err
}

return client.CreateRole(roleName, string(assumeRolePolicyDocument), "", make(map[string]string), "/")
}

0 comments on commit 2080f91

Please sign in to comment.