Summary
CreateHCPRoles in cmd/create/accountroles/creators.go currently reads args.externalID, args.route53RoleArn, and args.vpcEndpointRoleArn from package-global CLI state rather than accepting them as explicit parameters.
While this is not a live production risk (the function has no external callers today), it couples the function to the Cobra args global, making it harder to call from non-CLI contexts (e.g. tests, SDK consumers) and potentially causing stale-value bugs if the function is reused across calls in the future.
Desired behaviour
- Add
externalID string as an explicit parameter to CreateHCPRoles.
- Thread
externalID into buildRolesCreationInput via the parameter instead of args.externalID.
- Consider doing the same for
route53RoleArn / vpcEndpointRoleArn (already passed as parameters, but still mutated into args inside the function on lines 328-329).
- Update all callers of
CreateHCPRoles to pass the new parameter.
Context
Identified during review of PR #3264 (ROSAENG-57781 — opt-in STS external ID support).
Comment: #3264 (comment)
Requested by: @olucasfreitas
Summary
CreateHCPRolesincmd/create/accountroles/creators.gocurrently readsargs.externalID,args.route53RoleArn, andargs.vpcEndpointRoleArnfrom package-global CLI state rather than accepting them as explicit parameters.While this is not a live production risk (the function has no external callers today), it couples the function to the Cobra
argsglobal, making it harder to call from non-CLI contexts (e.g. tests, SDK consumers) and potentially causing stale-value bugs if the function is reused across calls in the future.Desired behaviour
externalID stringas an explicit parameter toCreateHCPRoles.externalIDintobuildRolesCreationInputvia the parameter instead ofargs.externalID.route53RoleArn/vpcEndpointRoleArn(already passed as parameters, but still mutated intoargsinside the function on lines 328-329).CreateHCPRolesto pass the new parameter.Context
Identified during review of PR #3264 (ROSAENG-57781 — opt-in STS external ID support).
Comment: #3264 (comment)
Requested by: @olucasfreitas