Skip to content

Refactor: thread externalID and shared-VPC args through CreateHCPRoles explicitly #3265

Description

@coderabbitai

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions