Skip to content

Commit 99a6db2

Browse files
committed
OCM-12960 | fix: Use path flag with hcpsharedvpc policy creation
1 parent 32473d8 commit 99a6db2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cmd/create/operatorroles/by_prefix.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,7 @@ func createRolesByPrefix(r *rosa.Runtime, prefix string, permissionsBoundary str
323323
policyArns = append(policyArns, sharedVpcPolicyArn)
324324
} else if credrequest == aws.ControlPlaneCloudCredentialsRoleType {
325325
for _, arn := range []string{sharedVpcEndpointRoleArn, sharedVpcRoleArn} {
326-
sharedVpcPolicyArn, err := getHcpSharedVpcPolicy(r, arn,
327-
defaultPolicyVersion)
326+
sharedVpcPolicyArn, err := getHcpSharedVpcPolicy(r, arn, defaultPolicyVersion)
328327
if err != nil {
329328
return err
330329
}

cmd/create/operatorroles/common_utils.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,15 @@ func getHcpSharedVpcPolicy(r *rosa.Runtime, roleArn string, defaultPolicyVersion
7474
if err != nil {
7575
return "", err
7676
}
77-
policyName := fmt.Sprintf(aws.AssumeRolePolicyPrefix, userProvidedRoleName)
78-
policy := aws.GetPolicyArn(r.Creator.Partition, r.Creator.AccountID, policyName, "")
7977

8078
path, err := aws.GetPathFromARN(roleArn)
8179
if err != nil {
8280
return "", err
8381
}
8482

83+
policyName := fmt.Sprintf(aws.AssumeRolePolicyPrefix, userProvidedRoleName)
84+
policy := aws.GetPolicyArn(r.Creator.Partition, r.Creator.AccountID, policyName, path)
85+
8586
iamTags := map[string]string{
8687
tags.RedHatManaged: helper.True,
8788
tags.HcpSharedVpc: helper.True,

0 commit comments

Comments
 (0)