Skip to content

Account Management API: no plugin exists, so opt-in region enablement is unreachable #629

Closed

Description

@scttfrdmn

There is no account service namespace in emulator/ — no account_plugin.go. A tool that manages an account's opt-in region enablement (distinct from Organizations, and distinct from the aws:RequestedRegion permission boundary an SCP enforces) has no way to test that work against substrate at all; every call falls through to "service not emulated."

Context

Filed from automat — a research-computing account-vending tool built on top of substrate for testing (test/integration, currently pinned to v0.95.0). internal/baseline.EnsureRegions is a real, shipped feature: after vending a member account, it ensures the account's opt-in region enablement matches what an environment profile names, via exactly the four operations below. There is no way to exercise this against substrate today, so this path is emulator-untested.

Operations

  • ListRegions — read-first: which regions exist and their current opt-in status (ENABLED, ENABLED_BY_DEFAULT, DISABLED, DISABLING, ENABLING).
  • EnableRegion — opt an account into a region not enabled by default (e.g. ap-east-1, me-south-1).
  • DisableRegion — the reverse; refused for a region that's ENABLED_BY_DEFAULT (the ~17 regions every account starts with).
  • GetRegionOptStatus — poll target. Per AWS's own docs, EnableRegion/DisableRegion are asynchronous ("may take several minutes to several hours"), so a caller with no poll loop should not pass its own tests here — the same shape CreateAccount's IN_PROGRESS/DescribeCreateAccountStatus pair already gets right for Organizations (Organizations: OUs, policies, and account placement are unimplemented, so the whole account-vending surface is unreachable #578).

Behaviours worth modelling

  1. This is account-scoped, not organization-scoped. Region opt-in is a property of one account (management or member), unlike Organizations' OU/SCP tree. It should key off the calling account, not off organization state.
  2. The default-enabled set is fixed and should not require an EnableRegion call. A region in the always-on set answers ENABLED_BY_DEFAULT from the start; DisableRegion against one of those should refuse (AWS: ConstraintViolationException).
  3. EnableRegion/DisableRegion are idempotent against the target state, not the call. Re-enabling an already-ENABLED region should be a no-op success, not a duplicate-action error — this is the property that makes a re-vend (automat's own "ensure" semantics) safe to run twice.
  4. Async convergence should resolve on first observation, matching the pattern v0.97.0 established for DescribeCreateAccountStatus and the pattern requested for Config's conformance-pack status in AWS Config: no plugin exists, so recorder, delivery channel, and conformance packs are unreachable #580 — a waiter converges in one poll, with no wall-clock dependence, and the terminal status then never moves.

Priority relative to other open issues

Lower than #578 (closed)/#580 (Config)/#579 (SimulatePrincipalPolicy) for our purposes — region enablement is one of several internal/baseline slices, not the blocking one. Filed now because, unlike Config and SimulatePrincipalPolicy, nothing here was tracked at all.

Activity

  1. added
    type: feature
    priority: medium
    on Aug 14, 2026
  2. added this to the v0.99.0 milestone on Aug 14, 2026
  3. scttfrdmn commented on Aug 14, 2026

    @scttfrdmn
    OwnerAuthor

    Planned for v0.99.0. Two corrections and one deliberate omission, from checking the account/2021-02-01 model and the Account Management Reference Guide rather than working from the issue text.

    DisableRegion on a default Region is ValidationException, not ConstraintViolationException

    The issue's bullet 2 gives ConstraintViolationException. The account model declares no such error for DisableRegion. Its full error list is:

    AccessDeniedException (403), ValidationException (400), ConflictException (409), TooManyRequestsException (429), InternalServerException (500).

    ValidationExceptionReason has exactly two members — invalidRegionOptTarget and fieldValidationFailed — and the first is the one that exists for this case. So substrate will answer ValidationException with reason: invalidRegionOptTarget, for both a default Region and an unknown Region code. A refusal carrying a code the SDK has no catch branch for is worse than no refusal at all: the consumer's except never matches.

    (Same class of correction as v0.98.0's #620, where the issue's SCP/OU quota values were 1,000 each and the published values are 10,000 and 2,000.)

    ConflictException is still used, for the case the User Guide names verbatim: "You cannot cancel an opt-in or opt-out when it is in either ENABLING or DISABLING status. Otherwise, a ConflictException will be thrown."

    The open-request limits will not be modelled

    The User Guide contradicts itself. Under Processing times and request limits:

    Organizations can have 50 region-opt requests open at a given time across an AWS organization

    and in the CLI section of Enable or disable a Region in your organization:

    An organization can only have up to 20 region requests at a given time. Otherwise, you will receive a TooManyRequestsException.

    It also gives a per-account limit of 6 in-progress requests. Picking one of 50/20 would produce a TooManyRequestsException at a boundary AWS may not actually enforce, failing requests the real API accepts — the same "guessed refusal is worse than a missing one" rule that kept the resource-policy semantic reasons out of v0.98.0. Both limits are documented as not modelled instead, and this goes in the release's ## Provenance section.

    Everything else in the issue is confirmed

    • rest-json, POST /listRegions, /enableRegion, /disableRegion, /getRegionOptStatus, all responseCode: 200. EnableRegion/DisableRegion have no output shape — an empty 200.
    • signingName: "account", host account.<region>.amazonaws.com, no X-Amz-Target. Routing needs no alias entry, but it gets an explicit routing test anyway: SSO Admin is unreachable: parser.go maps a guessed X-Amz-Target prefix, not the real SWBExternalService #561 and organizations: every SDK call answers "service not emulated" — the X-Amz-Target prefix has no alias #610 were both "registered, unit-tested, unreachable from every SDK".
    • RegionOptStatus: ENABLED, ENABLING, DISABLING, DISABLED, ENABLED_BY_DEFAULT.
    • The two Region sets are published and will be seeded verbatim: 17 opt-in (af-south-1, ap-east-1, ap-east-2, ap-south-2, ap-southeast-3, ap-southeast-4, ap-southeast-5, ap-southeast-6, ap-southeast-7, ca-west-1, eu-central-2, eu-south-1, eu-south-2, il-central-1, me-central-1, me-south-1, mx-central-1) and 17 default (ap-northeast-1/2/3, ap-south-1, ap-southeast-1/2, ca-central-1, eu-central-1, eu-north-1, eu-west-1/2/3, sa-east-1, us-east-1, us-east-2, us-west-1, us-west-2).
    • Bullet 3's idempotence and bullet 4's advance-on-observation are both as described: GetRegionOptStatus resolves ENABLING → ENABLED on first observation and the terminal status never moves, following resolveCreateAccountStatus (emulator/organizations_account.go:334). Alternate outcomes — a Region pinned in ENABLING, the ConflictException path — are reachable through a control-plane seed rather than through nondeterminism.

    One thing worth knowing

    ec2SeededRegions (emulator/ec2_plugin.go:4098) seeds only us-east-1, us-west-2, eu-west-1, all as opt-in-not-required, and there is no shared region table in substrate. The account plugin gets its own tables; DescribeRegions and ListRegions will therefore disagree on how many Regions exist. Unifying them is a bigger change than this issue, so the divergence is documented rather than fixed here.

    Scoped to the four region operations. The other eleven account operations (contact information, primary email, account name) are out of scope.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumtype: feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions