Skip to content

spawn onboard — BYOA portal onboarding wizard (Slice 3) - #443

Merged
scttfrdmn merged 2 commits into
mainfrom
feat/portal-onboard-cli
Jul 26, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
feat/portal-onboard-cli

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

The CLI path for onboarding an AWS account to the spore.host portal — the equivalent of the web CloudFormation quick-create (companion backend PR: spore-host/spore-host #476).

Run with credentials for the account to onboard. spawn onboard:

  1. resolves the caller account via STS,
  2. generates a high-entropy per-account ExternalId (confused-deputy guard),
  3. idempotently creates the spore-portal-onboard cross-account role trusting the portal phone-home Lambda role under that ExternalId, with the EC2 launch + SSM + spored-scoped iam:PassRole permissions the portal needs, and
  4. SigV4-signs (lambda service) and POSTs {roleArn, externalId, region} to the AuthType: AWS_IAM phone-home Function URL, so the portal auto-registers the account and the handler binds it to the verified caller. Mirrors pkg/dns/client.go's signing.

Details

  • pkg/config/endpoints.go: GetPortalPhoneHomeRoleARN (env default → infra) + GetPortalPhoneHomeURL (env-only; the URL is account/region-derived by the tofu module).
  • Conventions: --json MarkDeprecated in favor of root -o/--output (spawn#40); onboard.go added to the cmd/ AWS-SDK import allowlist for iam (same as bot.go's ensureCrossAccountRole).
  • Idempotent: re-running when the role exists leaves its trust unchanged and re-registers.

Verified

Build + go vet clean; the two convention tests (import allowlist, flag conventions) pass. (Pre-existing TestCatalogValid failure — private ECR catalog images — is unrelated to this change.)

The CLI path for bringing an AWS account onto the spore.host portal (the
equivalent of the web CloudFormation quick-create). Run with credentials for the
account to onboard; it:
  1. resolves the caller account via STS,
  2. generates a high-entropy per-account ExternalId (confused-deputy guard),
  3. idempotently creates the `spore-portal-onboard` cross-account role trusting
     the portal phone-home Lambda role under that ExternalId, with the EC2 launch
     + SSM + spored-scoped iam:PassRole permissions the portal needs, and
  4. SigV4-signs (lambda service) and POSTs {roleArn, externalId, region} to the
     AuthType: AWS_IAM phone-home Function URL, so the portal auto-registers the
     account and the handler binds it to the verified caller. Mirrors
     pkg/dns/client.go's signing.

- pkg/config/endpoints.go: GetPortalPhoneHomeRoleARN (env default, infra) +
  GetPortalPhoneHomeURL (env-only, no default — the URL is account/region-derived
  by infra/tofu/portal-phone-home).
- Follows established conventions: --json MarkDeprecated in favor of root
  -o/--output (spawn#40); onboard.go added to the cmd/ AWS-SDK import allowlist
  for iam (same as bot.go's ensureCrossAccountRole pattern).

Build + go vet clean; the two convention tests (import allowlist, flag
conventions) pass. (Pre-existing TestCatalogValid failure re: private ECR catalog
images is unrelated.)
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 5.97015% with 189 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/onboard.go 6.18% 182 Missing ⚠️
pkg/config/endpoints.go 0.00% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

TestTier0_CommandCoverageGate requires every command to have a deliberate Tier 0
coverage decision. onboard does real IAM CreateRole + a SigV4 phone-home POST to
the AuthType:AWS_IAM Function URL — the role-creation + verified-caller flow needs
a real account and can't be faithfully served by Substrate, so it's deferred to
Tier 2/3 (its validate/signing logic is unit-tested). Same treatment as burst/dns.
@scttfrdmn
scttfrdmn merged commit 7deaa26 into main Jul 26, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the feat/portal-onboard-cli branch July 26, 2026 05:54
scttfrdmn added a commit that referenced this pull request Jul 28, 2026
Backfills Unreleased entries for #443 (spawn onboard), #444, #445 and #446,
which merged without changelog entries, and commits the generated reference
for spawn onboard — check-docs only diffs tracked files, so docs-gen/onboard.md
was never added when the command landed.

Sections reordered to Keep-a-Changelog order (Added first), matching prior
releases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant