Repository navigation
feat(aws): add javabin aws setup and aws doctor for SSO profiles - #8
Merged
Merged
Conversation
Developers no longer hand-write sso-session/profile blocks. `aws setup` adds [sso-session javabin], runs `aws sso login --sso-session javabin`, lists the user's roles in 553637109631 via SSO ListAccountRoles and writes one profile per role, named after the role (javabin-team-<team>, ...). Existing profiles are never modified; the config is backed up and written atomically with mode 0600. credentialsHelp now points at `javabin aws setup`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- WriteFile resolves a symlinked config (EvalSymlinks, dangling links too) and replaces/backs up the target instead of the link. - A role counts as covered only by a profile on sso_session javabin; other sessions get a javabin-team profile plus a warning, and roles with several profiles report that auto-discovery is off and how to fix it. - Set inserts new keys after indented sub-property blocks. - Accept "[profile a] # note" headers; conflict message names the role; check for the AWS CLI before writing; doctor tolerates a trailing / or #. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Without
AWS_PROFILE, team commands fell through to EC2 IMDS and timed out, and users had to hand-writesso-session/profileblocks in~/.aws/config.What
javabin aws setup [--dry-run] [--no-login] [--force]: ensures[sso-session javabin](javaBin Identity Center,eu-central-1,sso:account:access) inAWS_CONFIG_FILE/~/.aws/config; runsaws sso login --sso-session javabin(install hint ifawsmissing); reads the cached token (~/.aws/sso/cache/<sha1(javabin)>.json, checksexpiresAt); calls SSOListAccountRolesfor 553637109631; writes one profile per role.javabin-team-cupcake,javabin-developer,javabin-admin,javabin-readonly); a role without thejavabin-prefix gets one.sso_session = javabin, account, role,region = eu-central-1.secret's auto-pick unambiguous); ajavabinsession with another start URL stops unless--force; backup toconfig.bak-<timestamp>, atomic write, mode 0600.javabin aws doctor: session block, token validity, and the profilesecretwould use forapp.yaml.internal/awsconfigpackage: line-preserving INI editing (comments, order, nested sub-properties untouched), token cache,RoleListerinterface.credentialsHelpnow suggestsjavabin aws setupinstead ofaws configure sso.github.com/aws/aws-sdk-go-v2/service/ssoas a direct dependency (was indirect at the same version).Checks
gofmt -l .clean,go vet ./...,go test ./...pass.--force, conflicting profile left alone, role covered by another profile, backup + 0600, token cache (fake dir, valid/expired/missing), end-to-end setup with fake login +RoleLister, dry-run writes nothing.aws setup --dry-runandaws doctoragainst an empty tempHOME. No realaws sso loginwas run.🤖 Generated with Claude Code