Files
floci/docs/services/controltower.md
T
Sam Fakhreddine 45240998ac feat(controltower): add AWS Control Tower with landing-zone and baseline lifecycle (#2578)
* feat: controltower models + service (TDD)

Adds LandingZone/EnabledBaseline models and ControlTowerService with a
lazy-seeded landing zone, UpdateLandingZone reconciliation sink, static
baseline catalog, and IdentityCenter auto-enable derivation. Unblocks
LZA's Prepare stage (controlTower.enable: true) which otherwise fails
with UnknownOperationException on POST /list-landingzones.

Landing zone version is pinned to "4.0" to satisfy LZA's
validateLandingZoneVersion check, and the seeded manifest always
includes securityRoles (dereferenced unguarded by LZA's
makeManifestDocument). Empty ListLandingZones is never observable
since that is LZA's create-path trigger, which floci does not
implement (see issues/controltower/01-gap-analysis.md).

12/12 unit tests (U1-U12) pass.

* feat: controltower REST-JSON controller + catalog wiring (TDD)

Adds the 8 Control Tower routes (list/get/update landing zone, landing
zone operation polling, list baselines, list/enable enabled baselines,
baseline operation polling) and wires the service into EmulatorConfig
and ResolvedServiceCatalog so it's health-checked and routed like any
other emulated service. Integration tests I1-I6 exercise the same
sequence LZA's Prepare stage drives: seed read, manifest reconcile via
UpdateLandingZone, register-OU baseline enable/poll, and per-account
isolation.

* docs: controltower service

Documents the pre-seed/reconciliation-sink model, the pinned 4.0
landing-zone version, the IdentityCenter baseline auto-enable rule,
and the explicit non-goals (create-landing-zone path, sso-admin,
identitystore, IAM/KMS/Organizations create-path prerequisites).

* feat(controltower): baseline update/reset operation groundwork

Cherry-picked from the ControlTower-scoped slice of 919285e6, which
bundled this alongside an unrelated ConfigService delivery-channel fix
directly on integration/all-features and never made it to this branch.

Adds EnabledBaseline.lastOperationIdentifier, a getEnabledBaseline
lookup helper, and a recordOperation helper that also tracks insertion
order -- the plumbing ResetEnabledBaseline/UpdateEnabledBaseline (next
commit) build on top of.

* feat(controltower): add landing zone lifecycle and operation tracking

(cherry picked from commit 3ddea8f3afd1aebe065b504fe877f21851809438)

* fix(controltower): correct CreateLandingZone route typo

@Path("/create-landing-zone") didn't match botocore's real wire route
/create-landingzone (no hyphen, matching every sibling ControlTower
route's convention) -- confirmed against gate.py, which flipped from
MISSING to SUPPORTED after the fix. The existing test had been
silently exercising the wrong path all along.

* chore: drop local-only bug-ledger file before upstream

issues/0026 is this fork's internal tracking, not something upstream
has a convention for.

* fix(config): declare controltower enabled toggle in both application.yml files

Upstream's ServiceConfigYamlCoverageTest requires every service config with an
enabled() toggle to declare it explicitly in both files; this branch predates
that test and fails it without the declaration.

* fix: reconcile Control Tower OU guardrails

* fix: seed Control Tower SNS prerequisite

* docs(controltower): add the service matrix row

* fix(controltower): validate landingZoneIdentifier on Get/UpdateLandingZone

GetLandingZone and UpdateLandingZone accepted any request body and answered
with the stored landing zone regardless of which one the caller named, so an
unknown ARN still returned the seeded landing zone instead of an error.

Both now require landingZoneIdentifier and return ResourceNotFoundException
when it does not match the stored ARN, matching real Control Tower.

The check seeds before comparing, unlike Delete/ResetLandingZone which must
report a missing landing zone rather than re-seed one. That keeps the lazy
seed intact: LZA reads ListLandingZones first and passes back the ARN it
returns, so the reconciliation-sink path is unaffected.

* fix(controltower): scope the operation ledger per account and region

The ledger backing GetLandingZoneOperation, ListLandingZoneOperations and
GetBaselineOperation was a single process-global map, so any caller could
enumerate every other account's operation identifiers, and it grew for the
lifetime of the process.

There is now one ledger per account+region, holding the most recent 250
operations and evicting the oldest. Read paths look the ledger up rather
than creating it, so an unknown scope cannot grow the map.

An identifier from another scope still answers with the default operation
type and SUCCEEDED rather than an error: that is the same restart-safe
behaviour an identifier issued before a restart gets, and LZA depends on it
when it polls an operation whose ledger entry is gone.

* docs(controltower): correct the CreateLandingZone path and the scope section

The operation table gave CreateLandingZone a hyphenated /create-landing-zone
path. The controller and the AWS Control Tower service model both spell it
/create-landingzone, one word, like every other landing-zone URI — the docs
were what was wrong, and both review bots flagged the controller because of
them.

The "deliberately not implemented" list also contradicted itself, describing
ResetLandingZone and ResetEnabledBaseline as implemented sinks under a
not-implemented heading. It is now split into operations that answer without
the underlying effect and operations nothing serves at all.

Also documents the identifier validation and the ledger scoping and cap added
in the preceding two commits, adds the missing ListLandingZoneOperations row,
and replaces the controller javadoc's stale operation count with a
description of the surface.

* fix(controltower): pin remediationTypes to its single modeled value

The current botocore Control Tower model constrains remediationTypes on
both CreateLandingZone and UpdateLandingZone to a list of exactly one
element (min 1 / max 1) whose only valid value is INHERITANCE_DRIFT.
The shared reader now rejects anything else with ValidationException
instead of silently storing it.

* fix(controltower): enforce modeled ARN and version constraints on EnableBaseline

EnableBaseline read baselineIdentifier, targetIdentifier and baselineVersion
and stored them verbatim. The botocore model pins all three: the two
identifiers to min 20 / ^arn:aws[0-9a-zA-Z_\-:\/]+$, and baselineVersion to
^\d+(?:\.\d+){0,2}$ with max length 10. UpdateEnabledBaseline right next to it
already validated the same shapes, so the two operations disagreed about what
they would accept.

targetIdentifier is the enabled-baseline storage key and feeds the
organizationalUnitId() substring parse, so a non-ARN value persisted a record
that no subsequent GetEnabledBaseline (which does check isArn) could reach.

Reject with ValidationException, the error the model lists for the operation,
and extract the version check into requireBaselineVersion so both operations
share one rule.
2026-08-26 13:44:31 -04:00

8.3 KiB

AWS Control Tower

Protocol: REST JSON Endpoint: http://localhost:4566

Floci implements the minimal AWS Control Tower surface required to unblock Landing Zone Accelerator's (LZA) AWSAccelerator-Pipeline Prepare stage when the universal config sets controlTower.enable: true. It is not a general-purpose Control Tower emulation; supported operations are listed below.

Pre-seed / reconciliation-sink model

Floci pre-seeds exactly one active landing zone per account+region the first time it is read (ListLandingZones, GetLandingZone, etc.). This matters because LZA's setup-landing-zone module treats an empty ListLandingZones result as its create-landing-zone trigger — an empty list is not a no-op, it cascades into an entire prerequisite chain (IAM roles, KMS keys, Organization.EnableAllFeatures, account moves) that Floci does not implement. By never returning an empty list on a fresh account+region, that branch stays unreachable. CreateLandingZone remains available for an account+region with no stored landing zone, while DeleteLandingZone removes the stored instance after validating its identifier.

Because Floci cannot predict every config value LZA's landingZoneUpdateOrResetRequired check will compare against the seed, UpdateLandingZone is implemented as a reconciliation sink: it accepts whatever manifest LZA sends, stores it verbatim, and reports the operation as SUCCEEDED. Any mismatch between the seed and LZA's computed configuration self-heals on the first UpdateLandingZone call of a pipeline run rather than failing.

The landing zone version and latestAvailableVersion are pinned to "4.0". LZA's validateLandingZoneVersion throws whenever an update or reset is required and latestAvailableVersion doesn't match the configured version, so this pin is load-bearing, not cosmetic.

The seeded manifest always includes a securityRoles object. LZA's makeManifestDocument (update branch) dereferences existingManifest.securityRoles.accountId with no optional chaining — an LZ without securityRoles crashes the first UpdateLandingZone call with a TypeError.

IdentityCenter auto-enable

register-organizational-unit throws when the landing zone's enableIdentityCenterAccess is true (universal config sets security.enableIdentityCenterAccess: true) but no IdentityCenterBaseline is enabled. Rather than implementing sso-admin/identitystore, Floci derives a synthetic IdentityCenterBaseline entry in ListEnabledBaselines at read time whenever the current landing-zone manifest has accessManagement.enabled: true — mirroring what real Control Tower does when IAM Identity Center access is turned on. Because it's derived at read time rather than materialized once, it tracks manifest changes (e.g. UpdateLandingZone flipping accessManagement.enabled to false) with no dual-write.

Supported Operations

Operation Method and path Description
ListLandingZones POST /list-landingzones Always returns the single seeded/reconciled landing zone
GetLandingZone POST /get-landingzone Returns the stored landing zone (arn, version, status, drift status, manifest, remediation types); requires landingZoneIdentifier, and an ARN that isn't the stored one returns ResourceNotFoundException
CreateLandingZone POST /create-landingzone Creates a landing zone from a manifest and version; returns its ARN and operation identifier
UpdateLandingZone POST /update-landingzone Reconciliation sink — stores the supplied manifest/version/remediation types and returns an operation id; requires a landingZoneIdentifier matching the stored landing zone
DeleteLandingZone POST /delete-landingzone Removes the stored landing zone and returns a delete operation id
ResetLandingZone POST /reset-landingzone Validates the landing zone identifier and returns a reset operation id
GetLandingZoneOperation POST /get-landingzone-operation Reports SUCCEEDED for any operation id, including ones not in the in-memory ledger (restart-safe)
ListLandingZoneOperations POST /list-landingzone-operations Lists the caller's landing-zone operations newest-first, with types/statuses filters and maxResults/nextToken pagination
ListBaselines POST /list-baselines Static 4-entry catalog: AWSControlTowerBaseline, IdentityCenterBaseline, AuditBaseline, LogArchiveBaseline, with region-stamped arns
ListEnabledBaselines POST /list-enabled-baselines Supports packet-defined baseline/target/status filters and maxResults/nextToken pagination. Child resources are not materialized; includeChildren returns configured parent resources only.
GetEnabledBaseline POST /get-enabled-baseline Returns an enabled baseline by ARN, including status, parameters, and optional parent/drift details; unknown ARNs return ResourceNotFoundException
EnableBaseline POST /enable-baseline Stores an enabled baseline keyed by target (OU or landing zone); re-enabling a target replaces rather than duplicates
ResetEnabledBaseline POST /reset-enabled-baseline Re-applies an enabled baseline by ARN; updates the lastOperationIdentifier and returns an operation id
UpdateEnabledBaseline POST /update-enabled-baseline Updates an enabled baseline's version and optional parameters; returns an operation id
GetBaselineOperation POST /get-baseline-operation Reports SUCCEEDED for any operation id, including ones not in the ledger

Every landing-zone URI spells "landingzone" as one word — /list-landingzones, /get-landingzone, /create-landingzone, /update-landingzone, /delete-landingzone, /reset-landingzone, /get-landingzone-operation, /list-landingzone-operations — matching the AWS Control Tower service model.

Configuration

Variable Default Description
FLOCI_SERVICES_CONTROLTOWER_ENABLED true Enable or disable Control Tower
FLOCI_STORAGE_SERVICES_CONTROLTOWER_MODE (inherits global) Optional Control Tower storage-mode override
FLOCI_STORAGE_SERVICES_CONTROLTOWER_FLUSH_INTERVAL_MS 5000 Hybrid storage flush interval in milliseconds

Landing zones and enabled baselines are isolated by account (via the account-aware storage wrapper) and by region (landing zone store key is the region; enabled-baseline store key is region::targetIdentifier).

The operation ledger that backs GetLandingZoneOperation, ListLandingZoneOperations, and GetBaselineOperation is in-memory and scoped the same way, one ledger per account+region. A caller only ever sees operations issued under its own account and region; an identifier from another scope is treated as unknown and answers with the default operation type and SUCCEEDED, exactly as an identifier issued before a restart does. Each ledger keeps the most recent 250 operations and evicts the oldest, so a long-running emulator does not grow it without bound.

Current Scope

This service exists to unblock LZA's Prepare stage, not to model Control Tower generally. Two kinds of gap follow from that, and they are different things.

Answered, but without the underlying effect. These operations validate their input and return a well-formed success response, so a caller that reaches them is not blocked — but nothing behind Control Tower's API actually changes:

  • ResetLandingZone — validates the landing zone identifier and returns a RESET operation id, leaving the stored manifest untouched.
  • ResetEnabledBaseline — validates the enabled-baseline ARN, refreshes its lastOperationIdentifier, and returns an operation id. It is unreachable on the Prepare-stage path (reregisterOu and enroll-accounts trigger it) and exists for later flows.

Not implemented at all. Nothing in Floci serves these, and nothing on the Prepare-stage path asks for them:

  • Any IAM/KMS/Organizations create-path prerequisite (CreateRole, CreateKey, EnableAllFeatures, etc.) — reachable only from the create-landing-zone branch that the pre-seed keeps unreachable.
  • sso-admin/identitystore — sidestepped by the synthetic IdentityCenter auto-enable derivation described above.
  • Org-wide CloudTrail and StackSets — manifest metadata only on the Prepare-stage path; not modeled as separate service calls.