Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improved Organization detection #122

Merged
merged 2 commits into from
Jun 24, 2024
Merged

Improved Organization detection #122

merged 2 commits into from
Jun 24, 2024

Conversation

dadgar
Copy link
Collaborator

@dadgar dadgar commented Jun 22, 2024

Changes proposed in this PR:

Previously, the organization was only auto-detected if both the organization and project ID were unset. Now if the organization is not set, it will be detected regardless of the project ID.

How I've tested this PR:

# Create a project SP and configure the cli to use it by setting the env vars
$ hcp iam sp keys create <sp-name>
$ export HCP_CLIENT_ID="..."
$ export HCP_CLIENT_SECRET="..."

# Override my active profile to have a bogus project ID and no org ID
$ printf 'name = "test"\norganization_id = ""\nproject_id = "2CDCE738-DB42-4FD4-8418-FDCF3A29B066"\n' > ~/.config/hcp/profiles/test.hcl
$ cat ~/.config/hcp/profiles/test.hcl && hcp profile display
name = "test"
organization_id = ""
project_id = "2CDCE738-DB42-4FD4-8418-FDCF3A29B066"

# Display the profile. This will run the detection logic because the organization ID isn't set.
# We can see it detected and set the org id but didn't touch the project ID as desired.
$ hcp profile display
name            = "test"
organization_id = "11ea8f23-1571-a43d-84e2-0242ac110007"
project_id      = "2CDCE738-DB42-4FD4-8418-FDCF3A29B066"

How I expect reviewers to test this PR:

Code review

Checklist:

  • Tests added if applicable
  • CHANGELOG entry added or label 'pr/no-changelog' added to PR

    Run CHANGELOG_PR=<PR number> make changelog/new-entry for guidance
    in authoring a changelog entry, and commit the resulting file, which should
    have a name matching your PR number. Entries should use imperative present
    tense (e.g. Add support for...)

dadgar added 2 commits June 21, 2024 17:43
Previously, the organization was only auto-detected if both the
organization and project ID were unset. Now if the organization is not
set, it will be detected regardless of the project ID.
@dadgar dadgar requested a review from jasonpilz June 22, 2024 00:48
@dadgar dadgar marked this pull request as ready for review June 22, 2024 00:48
@dadgar dadgar requested a review from a team as a code owner June 22, 2024 00:48
@dadgar dadgar merged commit 35825cd into main Jun 24, 2024
6 checks passed
@dadgar dadgar deleted the f-org-detect branch June 24, 2024 18:38
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants