diff --git a/pkg/aws/aws_client/role.go b/pkg/aws/aws_client/role.go index 3a10619..6324115 100644 --- a/pkg/aws/aws_client/role.go +++ b/pkg/aws/aws_client/role.go @@ -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), "/") +}