Skip to content

Commit

Permalink
Merge pull request #2703 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2702-to-release_1.2.49

[release_1.2.49] OCM-13016 | fix: Include path in create acc/op roles manual mode
  • Loading branch information
hunterkepley authored Dec 10, 2024
2 parents 45c064f + ddb1f1a commit 99fffdf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/roles/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ func GetHcpSharedVpcPolicyDetails(r *rosa.Runtime, roleArn string) (bool, string
if err != nil {
return false, "", "", err
}
path, err := aws.GetPathFromARN(roleArn)
if err != nil {
return false, "", "", err
}

policyName := fmt.Sprintf(aws.AssumeRolePolicyPrefix, roleName)

predictedPolicyArn := aws.GetPolicyArn(r.Creator.Partition, r.Creator.AccountID, policyName, "")
predictedPolicyArn := aws.GetPolicyArn(r.Creator.Partition, r.Creator.AccountID, policyName, path)

existsQuery, _ := r.AWSClient.IsPolicyExists(predictedPolicyArn)

Expand All @@ -53,7 +57,7 @@ func GetHcpSharedVpcPolicyDetails(r *rosa.Runtime, roleArn string) (bool, string
AddParam(awscb.PolicyName, policyName).
AddParam(awscb.PolicyDocument, interpolatedPolicyDetails).
AddTags(iamTags).
AddParam(awscb.Path, "").
AddParam(awscb.Path, path).
Build()

return existsQuery != nil, createPolicy, policyName, nil
Expand Down

0 comments on commit 99fffdf

Please sign in to comment.