Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.
Python awsaws-emulatoraws-localaws-sdkdevtoolsdockerdynamodbec2emulatorlambdalocalstacklocalstack-alternativeministackmock-awsopen-sourcepythons3sqsterraform
release v1.5.4 (#1575)
Nahuel Nuceraeaee9637dcf9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d01a4eff..e8584f59 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,17 +5,36 @@ All notable changes to MiniStack will be documented here.Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).Versioning follows [Semantic Versioning](https://semver.org/).-## [Unreleased]+## [1.5.4] — 2026-08-31++### Added+- **AppSync — `APPSYNC_JS` resolvers execute** — resolver code was stored and never run; `request()` now decides what the data source is asked for and `response()` shapes the answer, with `util.error`, `util.appendError` and `runtime.earlyReturn` following AWS in both of its documented positions, pipeline resolvers threading `ctx.stash`, and `extensions.evictFromApiCache` recorded back to the service. `NONE`, `HTTP`, `AMAZON_DYNAMODB` and `AWS_LAMBDA` data sources execute; the remaining types refuse with `NotImplemented`. Evaluation runs on a pool of Node workers — one evaluation in flight per worker, a 30-second bound with kill-and-respawn, a heap cap, and resolver console output surfaced in the service log. Contributed by @jbschooley.+- **AppSync — queries are parsed and executed with `graphql-core`** — the regex data plane failed silently on aliases, fragments, nested selection sets, variables with defaults and directives; an API with a schema now parses, validates and executes with the reference engine (an AppSync prelude supplies the `AWS*` scalars and `@aws_*` directives), while a schemaless API keeps the previous lenient path. Adds `graphql-core` as a dependency. Contributed by @jbschooley.+- **AppSync — schema creation, pipeline functions, environment variables and the `Update*` operations** — `StartSchemaCreation`, `GetSchemaCreationStatus`, `GetIntrospectionSchema` (SDL verbatim, or a real introspection document for `format=JSON`), the function operations, `Put`/`GetGraphqlApiEnvironmentVariables` and `UpdateDataSource` / `UpdateResolver` / `UpdateFunction` / `UpdateType` all answered `Unsupported route`. `CreateGraphqlApi` also omitted `apiType`, `visibility` and `introspectionConfig` and left tags off the API object, so a no-change Terraform plan proposed replacing the API; required members are validated rather than silently defaulted. Contributed by @jbschooley.+- **AppSync — the API cache, control plane and data plane** — the five `ApiCache` operations answered `Unsupported route`; they now round-trip a record carrying `healthMetricsConfig`, with `ttl` (1–3600), `apiCachingBehavior` and `type` required and validated as on AWS, and the data plane serves query resolvers from the cache under both caching behaviors, mutations excluded. Contributed by @jbschooley.+- **AppSync — nested type resolvers, `ctx.identity` from Cognito, `ctx.env` and `ctx.error`** — only top-level `Query`/`Mutation` fields resolved and `ctx.identity` was only ever set by a Lambda authorizer; a resolved value's type now runs its own resolvers with the parent as `ctx.source`, a Cognito token populates `ctx.identity`, and `response()` sees a data source failure as `ctx.error`. Contributed by @jbschooley.+- **AppSync — the `@aws-appsync/utils/dynamodb` helpers, and `EvaluateCode`** — the helper sub-module was stripped with every other import, so `ddb.get`/`put`/`update`/`remove`/`scan`/`query` died with "ddb is not defined"; they are provided and bound to whatever name the import used, and `EvaluateCode` tests a handler before it is attached to an API. Contributed by @jbschooley.+- **AppSync — `util.transform` DynamoDB expression builders and the rest of the `util` surface** — `util.transform` was an empty object and 8 of the 21 members `@aws-appsync/utils` declares were provided; `toDynamoDBFilterExpression`/`toDynamoDBConditionExpression` now build the `{expression, expressionNames, expressionValues}` triple over AWS's documented operator set, and the missing `util` members (`base64*`, `url*`, `escapeJavaScript`, `matches`, `authType`, real `autoUlid`/`autoKsuid`, `util.str`, `util.math`, `util.time`, the `util.dynamodb` `to*` family, `util.rds.toJsonObject`) are implemented, with the rest refusing by name. Contributed by @jbschooley.+- **Aurora DSQL — foreign key constraints** — every `REFERENCES` / `FOREIGN KEY` clause was refused `0A000`; they now reach the backend as written, with the two DSQL-specific rules enforced against a live cluster (eu-central-1, 2026-08-30): `ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY` must use `NOT VALID`, and `DEFERRABLE` is refused on any other kind of constraint, in the service's own wordings. Contributed by @vivedo.+- **Aurora DSQL — change data capture streams, and `GetVpcEndpointServiceName`** — the four CDC stream operations answered `ValidationException`; streams now create, describe, list, page, tag and delete with the API's shapes (`clientToken` idempotency, the 5-per-cluster quota as `ServiceQuotaExceededException`). Metadata only: no change record reaches the Kinesis target, and a visibly broken target lands the stream `FAILED` with the service's `statusReason` code. `GetVpcEndpointServiceName` answers a stable per-cluster name. Contributed by @vivedo.+- **Aurora DSQL — `SELECT ... FOR KEY SHARE`** — refused `0A000` alongside `FOR SHARE` and `FOR NO KEY UPDATE` although the live service takes it since 2026-08-25; it is now forwarded, and only the other two are refused. Contributed by @vivedo.+- **IoT Core — `ListThingGroupsForThing`** — the reverse lookup answered `Unsupported IoT path`, so resolving a thing's groups meant scanning every group; it now returns `{groupName, groupArn}` pairs from the bidirectional membership store, with `ResourceNotFoundException` for an unknown thing. The full list comes back in one page, like the service's other list operations. Contributed by @iot-rocket.+- **CloudFormation — `AWS::IoT::CACertificate` provisions onto the CA registry** — a template declaring the type rolled the stack back with `Unsupported resource type`. The provisioner now drives the real API: create registers the PEM with `RegistrationConfig` and `CertificateMode` (stored and reported by `DescribeCACertificate`, `DEFAULT` when omitted), update applies `Status` / `AutoRegistrationStatus` / `RegistrationConfig` / `RemoveAutoRegistration` in place, and delete deactivates first, because an ACTIVE CA refuses `DeleteCACertificate`. A PEM that is already registered fails the create, as CloudFormation does for an existing resource, and a changed `CACertificatePem` or `CertificateMode` fails the update loudly rather than silently replacing the CA — the id is derived from the certificate content. `Tags` are not modeled. Contributed by @iot-rocket.+- **KMS — `GenerateRandom`** — the one keyless KMS operation answered `InvalidAction`; it now returns the requested 1–1024 bytes from `os.urandom`, refuses an omitted or out-of-range `NumberOfBytes` with the service's `ValidationException` wording, answers `CustomKeyStoreNotFoundException` for a `CustomKeyStoreId`, and refuses the Nitro-enclave `Recipient` parameter loudly rather than answering a plaintext shape real KMS never returns there. Contributed by @iot-rocket.-### Added-- **Aurora DSQL — foreign key constraints** — every `REFERENCES` / `FOREIGN KEY` clause was refused `0A000`, so a schema with referential integrity could not be created at all; Aurora DSQL has supported foreign keys since 2026-08-26. They now reach the backend as written — the five referential actions, `MATCH FULL` / `MATCH SIMPLE`, self-references, composite keys and deferrability — with the two DSQL-specific rules enforced, measured against a live cluster (eu-central-1, 2026-08-30): `ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY` must use `NOT VALID` (as `CHECK` already did, with `ALTER TABLE ASYNC ... VALIDATE CONSTRAINT` validating it as a job afterwards), and `DEFERRABLE` is refused on any other kind of constraint, in the service's three wordings (`DEFERRABLE constraint not supported`, `CHECK constraints cannot be marked DEFERRABLE`, and `ALTER TABLE / ADD CONSTRAINT UNIQUE / DEFERRED / INITIALLY DEFERRED not supported`), DSQL restricting it to foreign keys; `NOT DEFERRABLE` and `INITIALLY IMMEDIATE` declare no deferral and are accepted anywhere. Referential integrity is the backend's, so a referencing write racing a change to the referenced key waits on a row lock instead of failing the loser with `40001` (OC000). Contributed by @vivedo.-- **Aurora DSQL — `SELECT ... FOR KEY SHARE`** — the clause was refused `0A000` alongside `FOR SHARE` and `FOR NO KEY UPDATE`, which matched a live cluster in August but not the service since 2026-08-25; it is now forwarded, and only `FOR SHARE` and `FOR NO KEY UPDATE` are refused. Contributed by @vivedo.-- **Aurora DSQL — change data capture streams, and `GetVpcEndpointServiceName`** — `CreateStream` and the three other CDC operations answered `ValidationException` (`Unknown path`), so an application that provisions a stream alongside its cluster could not be pointed at MiniStack at all; CDC went GA on 2026-07-08. Streams now create, describe, list, page, tag and delete with the API's shapes and defaults — `clientToken` idempotency, the 5-per-cluster quota as `ServiceQuotaExceededException` (`You have reached the stream limit.`), and a cluster's streams going with it on delete. Metadata only: no change record reaches the Kinesis target, so a stream is `ACTIVE` on creation unless its target is one MiniStack can see is broken — an absent Kinesis stream, or a role that cannot be assumed under `AUTH=true` — which lands `FAILED` carrying the service's `statusReason` error code. `GetVpcEndpointServiceName`, missing since the emulator landed, answers a stable per-cluster `com.amazonaws.<region>.dsql-<suffix>`. Contributed by @vivedo.-- **IoT Core — `ListThingGroupsForThing`** — `GET /things/{thingName}/thing-groups` answered `400 InvalidRequestException: Unsupported IoT path`, so resolving which groups a thing belongs to meant running `ListThingsInThingGroup` over every group; the forward lookup existed, the reverse one did not. The membership store was already bidirectional, so the operation now reads the thing record's group names and returns `{groupName, groupArn}` pairs, with `ResourceNotFoundException` for an unknown thing. The full list comes back in one page — `maxResults` / `nextToken` are deliberately not honored, like the other IoT list operations here. Contributed by @iot-rocket.+### Changed+- **AppSync — an API's auth modes are enforced** — a data-plane request satisfying none of the API's configured providers now answers `401 UnauthorizedException`, as on AWS; previously an API declaring `AMAZON_COGNITO_USER_POOLS` served a caller with no credentials at all. Credentials are still not verified — what is refused is the absence of any credential. Contributed by @jbschooley.### Fixed-- **Aurora DSQL — the `ALTER TABLE` refusals answer what the service answers** — measuring the emulator against a live cluster (eu-central-1, 2026-08-30) found four statements answered differently. A refused `ADD CONSTRAINT` — `PRIMARY KEY`, an inline `UNIQUE`, `EXCLUDE`, or a `CHECK`/`FOREIGN KEY` without `NOT VALID` — drew three invented messages where DSQL answers one, `unsupported ALTER TABLE ADD CONSTRAINT statement`. `ADD COLUMN` refused only `DEFAULT` and `NOT NULL` and let `REFERENCES`, `UNIQUE`, `CHECK`, `GENERATED ... STORED` and an inline identity through, where DSQL takes `name type [STORAGE mode]` and nothing else (`ALTER TABLE ADD COLUMN with constraint not supported`, a bare `NULL` apart, and `COLLATE clause not supported` for a collation); `ALTER COLUMN ... ADD GENERATED AS IDENTITY` on an existing column is unaffected. `ALTER TABLE ASYNC ... VALIDATE CONSTRAINT` over rows that break the constraint relayed the backend's `23503` at submit time, where DSQL hands back a `job_id` and fails the job — `sys.jobs` now reports `failed` with the violation as `details` and `sys.wait_for_job` answers false. Adding several columns in one statement also read the second action as part of the first column's type. Contributed by @vivedo.-- **Cognito — `AdminListUserAuthEvents` requires user-pool add-ons, as real Cognito does** — the call answered `{"AuthEvents": []}` for every pool, but AWS refuses it with `UserPoolAddOnNotEnabledException` (400) unless the pool's `UserPoolAddOns.AdvancedSecurityMode` is enabled; the permissive empty list let caller bugs an add-ons check would surface — such as indexing into the events unguarded — pass locally and fail against real AWS. The stored `UserPoolAddOns` now gates the operation; with add-ons enabled the answer stays an empty list, since auth events are never recorded. Contributed by @iot-rocket.+- **Persistence — a module that failed to load no longer overwrites its state** — the stand-in for a module that cannot import reported empty state and `save_all` wrote it over the service's file, so one bad boot silently destroyed everything that service had persisted; the stand-in now reports `None` and the file is left alone. Contributed by @jbschooley.+- **ECS — a restored service relaunches its tasks** — a restart restored every task `STOPPED` (its container went with the process) and nothing reconciled the services, so a service reported its persisted `runningCount` while nothing listened; ACTIVE services are now reconciled once after a restore on a daemon thread, a service that cannot relaunch is logged and skipped, and ECS joins the boot eager-load list when persisted services exist so a workload reached only through a load balancer recovers too. Contributed by @jbschooley.+- **Six fields accepted on write but never reported on read** — Lambda's `EventSourceMappingArn` (absent on create/get/list, so Terraform read no ESM tags), s3control's `ListTagsForResource` tag wrapper (`<member>` where the model says `<Tag>`, unparseable by aws-sdk-go-v2), Kinesis's `KeyId` alongside `EncryptionType`, RDS's `ServerlessV2ScalingConfiguration` and `PerformanceInsightsRetentionPeriod`, and Cognito's `UserAttributeUpdateSettings` and a disabled `SoftwareTokenMfaConfiguration` all round-trip now, each omitted when never set so an unset field does not read as drift. Contributed by @jbschooley.+- **ECS — a task runs on the architecture its task definition declares** — `runtimePlatform` was stored and never read, so Docker chose the host's architecture and an `ARM64` task on an x86_64 host started a container that could not execute its entrypoint; the declared architecture is now passed to Docker. Contributed by @jbschooley.+- **Lambda — a function runs on the architecture it declares** — the container was created without a platform whatever `Architectures` said; the declared architecture is now passed to Docker, and a cached image of the wrong architecture is re-pulled rather than failing opaquely at run. Contributed by @jbschooley.+- **AppSync — an anonymous operation that declares variables is parsed** — `mutation($x: T!) { … }` with no space after the keyword — what every SDK sends — never matched the operation pattern, so the whole document was read as one field named "mutation" and answered null with no error. Contributed by @jbschooley.+- **AppSync — resolver execution no longer blocks the event loop** — a resolver whose data source calls back into MiniStack deadlocked the request; execution and `EvaluateCode` now run on worker threads. Contributed by @jbschooley.+- **Cognito — `AdminListUserAuthEvents` requires user-pool add-ons** — the call answered `{"AuthEvents": []}` for every pool where AWS refuses with `UserPoolAddOnNotEnabledException` (400) unless `UserPoolAddOns.AdvancedSecurityMode` is enabled; the stored add-ons now gate the operation, before user resolution, and with add-ons enabled the answer stays an empty list since events are never recorded. Contributed by @iot-rocket.+- **Aurora DSQL — the `ALTER TABLE` refusals answer what the service answers** — measured live (eu-central-1, 2026-08-30): a refused `ADD CONSTRAINT` drew three invented messages where DSQL answers one, `ADD COLUMN` accepted constraint clauses DSQL refuses, and `ALTER TABLE ASYNC ... VALIDATE CONSTRAINT` over violating rows failed at submit time where DSQL fails the job — `sys.jobs` now reports `failed` with the violation as `details`. Contributed by @vivedo.## [1.5.3] — 2026-08-28@@ -25,21 +44,12 @@ Versioning follows [Semantic Versioning](https://semver.org/).- **IoT Core — provisioning templates, and `AWS::IoT::ProvisioningTemplate`** — `CreateProvisioningTemplate` and the four other template operations answered `Unsupported IoT path` and the CloudFormation type rolled back as unsupported; both now work with the wire shapes of the real service (`ResourceAlreadyExistsException` on duplicates, absent-not-empty `description`, 1-36 char names, a `templateBody` without an `AWS::IoT::Certificate` resource refused). Storage + CRUD only: the fleet-provisioning MQTT workflow is not implemented and versions are not modeled. Contributed by @iot-rocket.- **API Gateway — registered custom domains route the data plane** — a request addressed by a registered domain fell through host-pattern service guessing (typically into S3, or into IoT when the name contained `iot.`); it now resolves through the domain's base-path mappings before any guessing — longest base path wins, `"(none)"` is the root mapping, a mapping's stage is authoritative — matching the `BASE_PATH_MAPPING_ONLY` routing mode the records default to. Unregistered hosts are unchanged. Contributed by @iot-rocket.- **CloudFormation — in-place update handlers** — a stack update fell through to a destructive re-create for 106 of 132 registered types, wiping published Lambda versions, DynamoDB items, SQS messages and IAM attachments; `AWS::Lambda::Function`, `AWS::DynamoDB::Table`, the four API Gateway types, `AWS::IoT::TopicRule`, `AWS::SNS::Topic`, `AWS::SQS::Queue`, `AWS::Logs::LogGroup`, `AWS::S3::BucketPolicy`, `AWS::IAM::Role` and `AWS::IAM::ManagedPolicy` now update in place through their service's own APIs, replacing only for genuinely create-only properties, as CloudFormation documents per property. Contributed by @iot-rocket.-- **AppSync — `util.transform` DynamoDB expression builders** — DynamoDB is the data source most AppSync APIs use, and `toDynamoDBFilterExpression` is how a resolver turns a GraphQL filter argument into something DynamoDB can evaluate, so of the four transform functions it is the one that gets called; it returned nothing, because `util.transform` was an empty object. It now builds the `{expression, expressionNames, expressionValues}` triple over AWS’s documented operator set — `eq`, `ne`, `lt`, `le`, `gt`, `ge`, `contains`, `notContains`, `beginsWith`, `between`, `in`, `attributeExists`, `attributeType` — with `and`/`or`/`not` nesting and sibling conditions ANDed. `toDynamoDBConditionExpression` shares it, being the same grammar. Contributed by @jbschooley.-- **AppSync — the rest of the `util` surface** — 8 of the 21 members `@aws-appsync/utils` declares were provided, and three of those were wrong rather than incomplete: `autoUlid` returned a UUID, `util.dynamodb` had a single pass-through `toDynamoDB` that produced no AttributeValue shapes, and `util.transform` was an empty object so a call failed as “not a function” away from the cause. Adds `base64Encode`/`Decode`, `urlEncode`/`Decode`, `escapeJavaScript`, `matches`, `authType`, real `autoUlid` and `autoKsuid`, `util.str.normalize`, all of `util.math`, the six missing `util.time` functions, the full `util.dynamodb` `to*` family, and `util.rds.toJsonObject`. `util.xml`, `util.transform` and the `util.http` response-header functions throw naming themselves, since they need an XML parser, a DynamoDB expression builder, or the response AppSync is building. Contributed by @jbschooley.-- **AppSync — the `@aws-appsync/utils/dynamodb` helpers, and `EvaluateCode`** — the helper sub-module was stripped along with every other import, which is right for the types-only root package but wrong here: `ddb.get`/`put`/`update`/`remove`/`scan`/`query` build the request objects a resolver returns, so a resolver using them died with “ddb is not defined”. They are now provided and bound to whatever name the import used. Fixing that surfaced a second bug — the compile cache re-ran the module on every call, throwing on any top-level `const` a resolver declares — so a module is now evaluated once with the injected globals closing over a mutable holder. `EvaluateCode` is implemented on top of the evaluator, so a resolver can be tested before it is attached to an API, as it can against AWS. Contributed by @jbschooley.-- **AppSync — nested type resolvers, `ctx.identity` from Cognito, `ctx.env` and `ctx.error`** — only top-level `Query`/`Mutation` fields resolved, so a resolver on a nested type never fired and its field was simply absent from the response, which is where most of an API’s resolvers live. A resolved value’s type is now looked up in the API’s SDL and the resolvers attached to it run with the parent as `ctx.source`. `ctx.identity` is populated from a Cognito token when the API is configured for a user pool — it was only ever set by a Lambda authorizer, so a Cognito API saw `null` and every permission check failed. `ctx.env` exposes the API’s environment variables, and `ctx.error` is set when the data source fails so `response()` can turn an upstream failure into its own error or a fallback. Contributed by @jbschooley.-- **AppSync — `APPSYNC_JS` resolvers execute** — resolver code was stored and never run: the executor dispatched on data source type and inferred an operation from the field arguments, so a resolver’s own logic never affected the answer, and four of the six data source types the control plane accepts fell through to a mock that echoed the arguments. `request()` now decides what the data source is asked for and `response()` shapes the answer, with `util.error` becoming a GraphQL error carrying its `errorType`, `util.appendError` riding alongside the data, and `runtime.earlyReturn` following what AWS documents in both places it can appear — from a function the data source and response handler are skipped and the next function runs, from a pipeline resolver the pipeline is skipped and the resolver’s own response handler still runs. Pipeline resolvers run their functions in order with `ctx.stash` carried across, and response handlers see both `ctx.prev.result` and `ctx.result`. All three `APPSYNC_JS` globals are provided, `extensions` included: its `evictFromApiCache` calls are recorded and handed back to the service, which is how a mutation invalidates a cached query. A resolver returning `{operation: "Invoke", payload}` sends that payload to a Lambda data source verbatim. Data source handlers and runtimes are registries, so `NONE`, `HTTP`, `AMAZON_DYNAMODB` and `AWS_LAMBDA` are entries rather than branches and the two remaining types refuse with `NotImplemented` instead of answering a mock. A resolver with no `APPSYNC_JS` code behaves exactly as before. No new dependency — evaluation reuses the Node the image already ships for the `nodejs*` Lambda runtimes. Note that Node is more permissive than the real `APPSYNC_JS` sandbox, so a resolver that runs here can still be refused on deploy. Contributed by @jbschooley.- **S3 — replication delivers, with `x-amz-replication-status`** — a bucket's replication configuration was stored and echoed but never acted on: no object ever reached the destination and `HeadObject` showed no replication metadata. A write (put, POST upload, copy, or multipart complete) matching an Enabled rule's prefix now lands a copy in the destination bucket with its own version, the source's metadata, storage class override, and tags; the source object answers `ReplicationStatus: COMPLETED` (or `FAILED` when the destination is gone or no longer versioned) and the replica answers `REPLICA`, on current and version-addressed reads alike. The copy is synchronous so tests see a deterministic status. Delete-marker replication and replica re-replication are not modeled. Reported by @cringdahl.-- **AppSync — the API cache, control plane and data plane** — `CreateApiCache`, `GetApiCache`, `UpdateApiCache`, `DeleteApiCache` and `FlushApiCache` all answered `Unsupported route`, so `aws_appsync_api_cache` could not be applied and an environment that enables caching in the cloud had to turn it off locally, diverging from the thing it is meant to reproduce. The five operations now round-trip a cache record — one per API, released with its API, surviving a restore — with `atRestEncryptionEnabled` and `transitEncryptionEnabled` fixed at create time and carried across an update rather than reverting to false. The data plane honours it as well, which the control plane alone did not: query resolvers consult the cache, following AppSync’s behaviour for `PER_RESOLVER_CACHING` and `FULL_REQUEST_CACHING`, with caching keys evaluated against the field’s arguments, identity and source, and a key that cannot be resolved disabling caching for that call rather than collapsing two callers onto one entry. Mutations neither read nor populate it, only successful results are cached, and `FlushApiCache` empties it. Contributed by @jbschooley.-- **AppSync — schema creation, pipeline functions, environment variables and the `Update*` operations** — `StartSchemaCreation`, `GetSchemaCreationStatus`, `GetIntrospectionSchema`, the function operations, `Put`/`GetGraphqlApiEnvironmentVariables` and `UpdateDataSource` / `UpdateResolver` / `UpdateFunction` / `UpdateType` all answered `Unsupported route`, so an API could be created but had no schema, no pipeline functions, and nothing about it could be changed in place. `CreateGraphqlApi` also omitted `apiType`, `visibility` and `introspectionConfig` — the first two `ForceNew` in the Terraform provider, so a no-change plan proposed replacing the API and every resource beneath it — and left the tags it was given off the API object, where the provider reads them. The SDL is stored as given and served back verbatim rather than parsed. Contributed by @jbschooley.### Fixed- **CloudFormation — a resource that cannot be deleted fails the operation** — a missing delete handler was a log warning and `DeleteStack` reported `DELETE_COMPLETE` while resources lived on; the stack now lands `DELETE_FAILED` (failed resources retained for a retry, exports kept, deleted siblings gone) and a failed rollback lands `ROLLBACK_FAILED`/`UPDATE_ROLLBACK_FAILED`, per the documented lifecycle. `AWS::Lambda::Version` gained a real delete handler (its `Ref` now returns the qualified version ARN, as on AWS) and `AWS::AppSync::GraphQLSchema` one that removes the stored schema. Contributed by @iot-rocket.- **IoT Core — an HTTP shadow write publishes the reserved-topic notifications** — `UpdateThingShadow` over the REST data plane stored state and emitted nothing, so a topic rule on `.../shadow/update/accepted` fired for MQTT updates only; an accepted HTTP update now publishes `update/accepted`/`delta`/`documents` (and a delete its `delete/accepted`) through the same emission code as the MQTT bridge, which also fixed the `documents` envelope on both transports: it now echoes the request's `clientToken` and carries `state` + `metadata` + `version` only. Contributed by @iot-rocket.- **IoT Core — device-plane job timestamps were milliseconds, 1000x off** — `iot-jobs-data` responses served epoch milliseconds where the API reference words every stamp "in seconds since the epoch"; every device-plane stamp, HTTP and MQTT alike, is now whole epoch seconds. Contributed by @iot-rocket.-- **ECS — a task runs on the architecture its task definition declares** — `runtimePlatform` was stored on the task definition and never read again, so Docker chose the host's architecture. An `ARM64` task definition on an x86_64 host started a container that could not execute its own entrypoint, and the task still reported as started, because creating the container is the part that succeeds — the failure surfaced only as a service that never answered. The declared architecture is now passed to Docker; a task definition without a `runtimePlatform` is unchanged. Contributed by @jbschooley.-- **Lambda — a function runs on the architecture it declares** — the container was created without a platform, so Docker used the host's architecture whatever `Architectures` said. An arm64 function on an x86_64 host ran as x86_64, which is invisible until a layer carries a native wheel: the handler then dies at import naming the library rather than the mismatch (`no pq wrapper available`, from psycopg loading its own binary). The declared architecture is now passed to Docker, and a cached image of the wrong architecture is re-pulled for the right one rather than failing opaquely at run. Contributed by @jbschooley.- **Step Functions — execution status changes are published to EventBridge** — real Step Functions automatically emits `source: aws.states` / `detail-type: "Step Functions Execution Status Change"` to the default bus whenever a standard execution changes status; MiniStack ran the execution and published nothing, so a rule matching those events never fired and applications waiting on them hung with no error anywhere. Every `StartExecution` now emits `RUNNING` and its completion `SUCCEEDED`, `FAILED` (with `error`/`cause` and `REDRIVABLE`) or `ABORTED` on `StopExecution`, carrying the documented detail fields with epoch-millisecond dates; payloads over 248 KiB are excluded and flagged via `inputDetails`/`outputDetails`, and `StartSyncExecution` (the express-flavored path) emits nothing, as on AWS. Reported by @moonyseven.- **ECS — a service's tasks register in its target groups** — a `loadBalancers` block was stored and never acted on, so `DescribeTargetHealth` stayed empty and every request through the load balancer fell to the listener's default action; a service now reconciles its target groups from its running tasks' addresses (awsvpc tasks carry their address as `attachments[].details[privateIPv4Address]`, where real ECS reports it), withdrawing only its own registrations so manually registered targets and a second service sharing the group survive, as on AWS. Contributed by @jbschooley.- **ECS — an `awsvpc` task no longer publishes host ports** — each `awsvpc` task has its own network namespace on AWS, so container ports never bind on the host; publishing them made two tasks sharing a container port collide with a Docker bind error that cannot happen on Fargate. Only `bridge` and `host` modes publish. Contributed by @jbschooley.diff --git a/Dockerfile.full b/Dockerfile.fullindex eba339c7..a4dc0d05 100644--- a/Dockerfile.full+++ b/Dockerfile.full@@ -18,6 +18,7 @@ RUN pip install --no-cache-dir --no-compile \"aws-sam-translator>=1.90" \"boto3>=1.34" \"jsonata-python>=0.7.0" \+ "graphql-core==3.2.12" \"awscli==1.45.63"# Strip awscli help examples (~25 MB), Python cache files (~15 MB),diff --git a/README.md b/README.mdindex df035e7b..1dd15097 100644--- a/README.md+++ b/README.md@@ -579,7 +579,7 @@ MiniStack expands AWS SAM transforms (`Transform: AWS::Serverless-2016-10-31`) i| **EMR** | RunJobFlow, DescribeCluster, ListClusters, TerminateJobFlows, ModifyCluster, SetTerminationProtection, SetVisibleToAllUsers, AddJobFlowSteps, DescribeStep, ListSteps, CancelSteps, AddInstanceFleet, ListInstanceFleets, ModifyInstanceFleet, AddInstanceGroups, ListInstanceGroups, ModifyInstanceGroups, ListBootstrapActions, AddTags, RemoveTags, GetBlockPublicAccessConfiguration, PutBlockPublicAccessConfiguration | Control plane only — no real Spark/Hadoop; clusters start in WAITING (KeepAlive=true) or TERMINATED (KeepAlive=false); steps stored as COMPLETED immediately; all three instance modes (simple, InstanceGroups, InstanceFleets); TerminationProtected enforced; Pro-only on LocalStack — free here || **Cognito** | **User Pools**: CreateUserPool, DeleteUserPool, DescribeUserPool, ListUserPools, UpdateUserPool, CreateUserPoolClient, DeleteUserPoolClient, DescribeUserPoolClient, ListUserPoolClients, UpdateUserPoolClient, CreateResourceServer, UpdateResourceServer, DescribeResourceServer, DeleteResourceServer, ListResourceServers, AdminCreateUser, AdminDeleteUser, AdminGetUser, ListUsers, AdminSetUserPassword, AdminUpdateUserAttributes, AdminConfirmSignUp, AdminDisableUser, AdminEnableUser, AdminResetUserPassword, AdminUserGlobalSignOut, AdminAddUserToGroup, AdminRemoveUserFromGroup, AdminListGroupsForUser, AdminListUserAuthEvents, AdminInitiateAuth, AdminRespondToAuthChallenge, InitiateAuth, RespondToAuthChallenge, GlobalSignOut, RevokeToken, SignUp, ConfirmSignUp, ForgotPassword, ConfirmForgotPassword, ChangePassword, GetUser, UpdateUserAttributes, DeleteUser, CreateGroup, DeleteGroup, GetGroup, ListGroups, ListUsersInGroup, CreateUserPoolDomain, DeleteUserPoolDomain, DescribeUserPoolDomain, GetUserPoolMfaConfig, SetUserPoolMfaConfig, AssociateSoftwareToken, VerifySoftwareToken, AdminSetUserMFAPreference, SetUserMFAPreference, CreateIdentityProvider, DescribeIdentityProvider, UpdateIdentityProvider, DeleteIdentityProvider, ListIdentityProviders, GetIdentityProviderByIdentifier, AdminLinkProviderForUser, AdminDisableProviderForUser, TagResource, UntagResource, ListTagsForResource; **Identity Pools**: CreateIdentityPool, DeleteIdentityPool, DescribeIdentityPool, ListIdentityPools, UpdateIdentityPool, GetId, GetCredentialsForIdentity, GetOpenIdToken, SetIdentityPoolRoles, GetIdentityPoolRoles, ListIdentities, DescribeIdentity, MergeDeveloperIdentities, UnlinkDeveloperIdentity, UnlinkIdentity, TagResource, UntagResource, ListTagsForResource; **OAuth2**: /oauth2/token (client_credentials) | Stub JWT tokens (structurally valid base64url JWTs); SRP auth returns PASSWORD_VERIFIER challenge; **CUSTOM_AUTH flow** wired through the configured `DefineAuthChallenge` / `CreateAuthChallenge` / `VerifyAuthChallengeResponse` Lambda triggers (passwordless / magic-link / SMS-OTP); session TTL honors `AuthSessionValidity`, capped at 3 answered rounds per AWS; confirmation codes hardcoded (signup: 123456, forgot-password: 654321); TOTP SOFTWARE_TOKEN_MFA challenge flow; MFA config and per-user enrollment stored in-memory; **user pool domains**: `CreateUserPoolDomain` with `CustomDomainConfig` registers a custom domain served on its own FQDN (without it, `Domain` is a prefix expanded to `{prefix}.auth.{region}.amazoncognito.com`), and the SAML ACS URL and OIDC federation callback are built from it — set one when MiniStack is reached through an external TLS terminator, so external IdPs get a reachable `https://{domain}/oauth2/idpresponse` instead of the internal gateway address; **federated user linking**: `AdminLinkProviderForUser` links an external identity to an existing profile before its first sign-in, so that sign-in resolves to the linked profile instead of minting a second `{Provider}_id` one, and the profile carries the `identities` attribute (also an ID-token claim); `AdminListUserAuthEvents` requires `UserPoolAddOns.AdvancedSecurityMode` != `OFF`, else `UserPoolAddOnNotEnabledException` as on AWS — events themselves are never recorded, so the answer is always an empty list || **ECR** | CreateRepository, DescribeRepositories, DeleteRepository, ListImages, DescribeImages, PutImage, BatchGetImage, BatchDeleteImage, GetAuthorizationToken, GetRepositoryPolicy, SetRepositoryPolicy, DeleteRepositoryPolicy, PutLifecyclePolicy, GetLifecyclePolicy, DeleteLifecyclePolicy, ListTagsForResource, TagResource, UntagResource, PutImageTagMutability, PutImageScanningConfiguration, DescribeRegistry, GetDownloadUrlForLayer, BatchCheckLayerAvailability, InitiateLayerUpload, UploadLayerPart, CompleteLayerUpload | In-memory image registry; Docker V2 manifest support; authorization token generation; lifecycle policies; tag mutability; Pro-only on LocalStack — free here |-| **AppSync** | **GraphQL APIs**: CreateGraphQLApi, GetGraphQLApi, ListGraphQLApis, UpdateGraphQLApi, DeleteGraphQLApi, CreateApiKey, DeleteApiKey, ListApiKeys, CreateDataSource, GetDataSource, ListDataSources, DeleteDataSource, CreateResolver, GetResolver, ListResolvers, DeleteResolver, CreateType, ListTypes, GetType, TagResource, UntagResource, ListTagsForResource; **Event APIs**: CreateApi, GetApi, ListApis, UpdateApi, DeleteApi, CreateChannelNamespace, GetChannelNamespace, ListChannelNamespaces, UpdateChannelNamespace, DeleteChannelNamespace, CreateApiKey, ListApiKeys, DeleteApiKey, HTTP Publish, WebSocket subscribe/publish | GraphQL queries/mutations execute against DynamoDB resolvers; Lambda resolvers supported. Event APIs support AWS-shaped `/v2/apis` management, `/v1/apis/{apiId}/apikeys` API-key operations, `POST /event` on `*.appsync-api.*`, and realtime `*.appsync-realtime-api.*` WebSocket flows with API-key and Lambda-authorizer checks |+| **AppSync** | **GraphQL APIs**: CreateGraphQLApi, GetGraphQLApi, ListGraphQLApis, UpdateGraphQLApi, DeleteGraphQLApi, CreateApiKey, UpdateApiKey, DeleteApiKey, ListApiKeys, CreateDataSource, GetDataSource, ListDataSources, UpdateDataSource, DeleteDataSource, CreateResolver, GetResolver, ListResolvers, UpdateResolver, DeleteResolver, CreateFunction, GetFunction, ListFunctions, UpdateFunction, DeleteFunction, CreateType, GetType, ListTypes, UpdateType, StartSchemaCreation, GetSchemaCreationStatus, GetIntrospectionSchema, PutGraphqlApiEnvironmentVariables, GetGraphqlApiEnvironmentVariables, CreateApiCache, GetApiCache, UpdateApiCache, DeleteApiCache, FlushApiCache, EvaluateCode, TagResource, UntagResource, ListTagsForResource; **Event APIs**: CreateApi, GetApi, ListApis, UpdateApi, DeleteApi, CreateChannelNamespace, GetChannelNamespace, ListChannelNamespaces, UpdateChannelNamespace, DeleteChannelNamespace, CreateApiKey, ListApiKeys, DeleteApiKey, HTTP Publish, WebSocket subscribe/publish | GraphQL execution goes through `graphql-core` when the API has a schema (parse, validate, execute; an AppSync prelude supplies the `AWS*` scalars and `@aws_*` directives; a schemaless API keeps a lenient path); **`APPSYNC_JS` resolvers execute** — unit and pipeline, `util`/`runtime`/`extensions` globals, the `@aws-appsync/utils/dynamodb` helpers, `NONE`/`HTTP`/`AMAZON_DYNAMODB`/`AWS_LAMBDA` data sources — on a pool of warm Node workers (one evaluation in flight per worker, 30s bound with kill-and-respawn, heap cap; reuses the image's Node, no new dependency); `GetIntrospectionSchema` serves SDL or a real `format=JSON` introspection document; the API cache is honored by the data plane under `FULL_REQUEST_CACHING` and `PER_RESOLVER_CACHING`; a data-plane request satisfying none of the API's auth modes answers `401 UnauthorizedException`, as on AWS (credentials are not verified — only their absence is refused). Event APIs support AWS-shaped `/v2/apis` management, `/v1/apis/{apiId}/apikeys` API-key operations, `POST /event` on `*.appsync-api.*`, and realtime `*.appsync-realtime-api.*` WebSocket flows with API-key and Lambda-authorizer checks || **Cloud Map** | CreateHttpNamespace, CreatePrivateDnsNamespace, CreatePublicDnsNamespace, GetNamespace, ListNamespaces, DeleteNamespace, UpdateHttpNamespace, UpdatePrivateDnsNamespace, UpdatePublicDnsNamespace, CreateService, GetService, ListServices, DeleteService, UpdateService, RegisterInstance, DeregisterInstance, DiscoverInstances, DiscoverInstancesRevision, ListInstances, GetInstancesHealthStatus, UpdateInstanceCustomHealthStatus, GetServiceAttributes, UpdateServiceAttributes, DeleteServiceAttributes, GetOperation, ListOperations, TagResource, UntagResource, ListTagsForResource | DNS namespaces create Route53 hosted zones; operation tracking; Terraform `aws_service_discovery_*` compatible || **RDS Data API** | ExecuteStatement, BatchExecuteStatement, BeginTransaction, CommitTransaction, RollbackTransaction | Routes SQL to real Docker-backed RDS database containers; supports MySQL (pymysql) and PostgreSQL (psycopg2); REST paths (`/Execute`, `/BeginTransaction`, etc.) || **S3 Files** | CreateFileSystem, GetFileSystem, ListFileSystems, DeleteFileSystem, CreateMountTarget, GetMountTarget, ListMountTargets, UpdateMountTarget, DeleteMountTarget, CreateAccessPoint, GetAccessPoint, ListAccessPoints, DeleteAccessPoint, GetFileSystemPolicy, PutFileSystemPolicy, DeleteFileSystemPolicy, GetSynchronizationConfiguration, PutSynchronizationConfiguration, TagResource, UntagResource, ListTagsForResource | 21 operations; control plane for the new S3 Files service (launched April 2026); file systems, mount targets, access points, policies |diff --git a/ministack/services/athena.py b/ministack/services/athena.pyindex efdf0838..f5d8a57c 100644--- a/ministack/services/athena.py+++ b/ministack/services/athena.py@@ -202,7 +202,7 @@ except Exception:)try:- import duckdb+ import duckdb # noqa: F401 — the import is the availability probe_duckdb_available = Trueexcept ImportError:diff --git a/ministack/services/cloudformation/__init__.py b/ministack/services/cloudformation/__init__.pyindex 0de1b134..e7fb7cbe 100644--- a/ministack/services/cloudformation/__init__.py+++ b/ministack/services/cloudformation/__init__.py@@ -28,16 +28,6 @@ _stack_events = AccountRegionScopedDict() # stack_id -> [event list]_exports = AccountRegionScopedDict() # export_name -> {StackId, Name, Value}_change_sets = AccountRegionScopedDict() # cs_id -> change set dict-# Re-exports for compatibility-from .engine import ( # noqa: E402- _NO_VALUE,- _evaluate_conditions,- _extract_deps,- _parse_template,- _resolve_parameters,- _resolve_refs,- _topological_sort,-)from .helpers import _p # noqa: E402@@ -114,9 +104,7 @@ def restore_state(data):# Must be last — handlers imports from this module-from ministack.core.responses import get_account_id--from .handlers import _ACTION_HANDLERS, _validate_template # noqa: E402+from .handlers import _ACTION_HANDLERS # noqa: E402# Restore persisted stack metadata on first import (a CloudFormation request, or# the eager boot import when a state file exists). Failure falls back to a freshdiff --git a/ministack/services/cloudformation/provisioners.py b/ministack/services/cloudformation/provisioners.pyindex 4cea4808..32a774ba 100644--- a/ministack/services/cloudformation/provisioners.py+++ b/ministack/services/cloudformation/provisioners.py@@ -6787,28 +6787,38 @@ def _iot_provisioning_template_delete(physical_id, props):_iot._delete_provisioning_template(physical_id)+def _registration_config_payload(props):+ """CFN's RegistrationConfig (RoleArn/TemplateBody/TemplateName) in the+ API's camelCase, or None when the template declares none."""+ cfg = props.get("RegistrationConfig")+ if not cfg:+ return None+ out = {}+ for cfn_key, api_key in (("RoleArn", "roleArn"), ("TemplateBody", "templateBody"),+ ("TemplateName", "templateName")):+ if cfg.get(cfn_key) is not None:+ out[api_key] = cfg[cfn_key]+ return out or None++def _iot_ca_certificate_apply(ca_id, props):"""Bring an existing CA registration to the template's declared state."""+ body = {}+ reg_cfg = _registration_config_payload(props)+ if reg_cfg is not None:+ body["registrationConfig"] = reg_cfg+ if props.get("RemoveAutoRegistration"):+ body["removeAutoRegistration"] = Trueresp = _iot._handle_ca_certificate(- "PUT", f"/cacertificate/{ca_id}", b"", {- "newStatus": props.get("Status", "INACTIVE"),+ "PUT", f"/cacertificate/{ca_id}",+ json.dumps(body).encode() if body else b"", {+ "newStatus": props["Status"],"newAutoRegistrationStatus":"ENABLE" if props.get("AutoRegistrationStatus") == "ENABLE" else "DISABLE",},)if resp[0] >= 400:raise ValueError(f"AWS::IoT::CACertificate update failed: {resp[2]!r}")- if props.get("CertificateMode"):- if props["CertificateMode"] not in ("DEFAULT", "SNI_ONLY"):- raise ValueError(- "AWS::IoT::CACertificate CertificateMode must be one of ['DEFAULT', 'SNI_ONLY']"- )- # Deliberate simplification: real CloudFormation documents CertificateMode- # as update-requires-replacement (UpdateCACertificate has no mode member),- # so the mode is written on the record directly instead. Omitting it on an- # update keeps the old mode, where real CFN would revert to DEFAULT by- # replacing the certificate.- _iot._ca_certificates[ca_id]["certificateMode"] = props["CertificateMode"]return ca_id, {"Arn": _iot._ca_cert_arn(ca_id), "Id": ca_id}@@ -6816,28 +6826,28 @@ def _iot_ca_certificate_create(logical_id, props, stack_name):pem = props.get("CACertificatePem")if not pem:raise ValueError("AWS::IoT::CACertificate requires CACertificatePem")+ if not props.get("Status"):+ # Required: Yes in the resource reference — refuse rather than invent+ # a default CloudFormation does not have.+ raise ValueError("AWS::IoT::CACertificate requires Status")payload = {"caCertificate": pem,"verificationCertificate": props.get("VerificationCertificatePem"),"certificateMode": props.get("CertificateMode"),+ "registrationConfig": _registration_config_payload(props),}resp = _iot._register_ca_certificate({k: v for k, v in payload.items() if v is not None},{- "setAsActive": "true" if props.get("Status", "INACTIVE") == "ACTIVE" else "false",+ "setAsActive": "true" if props["Status"] == "ACTIVE" else "false","allowAutoRegistration": "true" if props.get("AutoRegistrationStatus") == "ENABLE" else "false",},)- if resp[0] == 409:- # The certificate id is derived from the PEM, so re-registering the- # same PEM answers ResourceAlreadyExists. CloudFormation's create must- # be idempotent — a rollback replay re-enters create — so adopt the- # existing registration and bring it to the declared state instead of- # failing the stack. Tradeoff: a CA the user registered out of band- # under the same PEM is adopted too (and mutated/deleted with the- # stack from here on) — an accepted simplification.- return _iot_ca_certificate_apply(json.loads(resp[2])["resourceId"], props)if resp[0] >= 400:+ # Includes a PEM that is already registered (the certificate id is+ # content-derived, so re-registering answers ResourceAlreadyExists):+ # real CloudFormation fails the create on a resource that already+ # exists rather than adopting one the stack never created.raise ValueError(f"AWS::IoT::CACertificate create failed: {resp[2]!r}")ca_id = json.loads(resp[2])["certificateId"]return ca_id, {"Arn": _iot._ca_cert_arn(ca_id), "Id": ca_id}@@ -6858,6 +6868,19 @@ def _iot_ca_certificate_update(physical_id, old_props, new_props, stack_name):"the certificate id is derived from the PEM. Declare a new ""CACertificate resource for the new PEM and remove this one.")+ if not new_props.get("Status"):+ raise ValueError("AWS::IoT::CACertificate requires Status")+ stored_mode = (_iot._ca_certificates.get(physical_id) or {}).get(+ "certificateMode", "DEFAULT")+ new_mode = new_props.get("CertificateMode") or "DEFAULT"+ if new_mode != stored_mode:+ # Update-requires-replacement in the resource reference, and+ # UpdateCACertificate carries no mode member — refuse the change the+ # way the KMS provisioner refuses its immutable properties.+ raise ValueError(+ "AWS::IoT::CACertificate cannot change CertificateMode in place: "+ "CloudFormation documents it as update-requires-replacement."+ )return _iot_ca_certificate_apply(physical_id, new_props)diff --git a/ministack/services/iot.py b/ministack/services/iot.pyindex faa774d0..d9840c5a 100644--- a/ministack/services/iot.py+++ b/ministack/services/iot.py@@ -1609,6 +1609,11 @@ def _register_ca_certificate(payload: dict, qp: dict) -> tuple:return error_response_json("InvalidRequestException", "caCertificate is required", 400)+ registration_config = payload.get("registrationConfig")+ if registration_config is not None and not isinstance(registration_config, dict):+ return error_response_json(+ "InvalidRequestException", "registrationConfig must be an object", 400+ )certificate_mode = payload.get("certificateMode") or "DEFAULT"if certificate_mode not in ("DEFAULT", "SNI_ONLY"):return error_response_json(@@ -1638,6 +1643,8 @@ def _register_ca_certificate(payload: dict, qp: dict) -> tuple:"creationDate": _now_epoch(),"ownedBy": get_account_id(),}+ if registration_config is not None:+ record["registrationConfig"] = registration_config_ca_certificates[ca_id] = recordreturn json_response({"certificateArn": record["certificateArn"],@@ -1686,7 +1693,11 @@ def _handle_ca_certificate(method: str, path: str, body: bytes, qp: dict) -> tup"certificateMode": record.get("certificateMode", "DEFAULT"),"ownedBy": record["ownedBy"],"creationDate": record.get("creationDate"),- }+ },+ # registrationConfig is a sibling of certificateDescription in+ # DescribeCACertificateResponse, omitted when never configured.+ **({"registrationConfig": record["registrationConfig"]}+ if record.get("registrationConfig") is not None else {}),})if method == "PUT":# newStatus / newAutoRegistrationStatus are query-string params per the@@ -1716,6 +1727,19 @@ def _handle_ca_certificate(method: str, path: str, body: bytes, qp: dict) -> tuprecord["status"] = new_statusif new_auto is not None:record["autoRegistrationStatus"] = new_auto+ # Body members per the model: registrationConfig replaces the stored+ # JITR provisioning config; removeAutoRegistration, when true, turns+ # auto-registration off.+ registration_config = payload.get("registrationConfig")+ if registration_config is not None:+ if not isinstance(registration_config, dict):+ return error_response_json(+ "InvalidRequestException",+ "registrationConfig must be an object", 400,+ )+ record["registrationConfig"] = registration_config+ if payload.get("removeAutoRegistration"):+ record["autoRegistrationStatus"] = "DISABLE"_ca_certificates[ca_id] = recordreturn json_response({})if method == "DELETE":diff --git a/pyproject.toml b/pyproject.tomlindex 2d3af933..22e44cca 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "ministack"-version = "1.5.3"+version = "1.5.4"description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"readme = "README.md"license = { file = "LICENSE" }diff --git a/tests/test_cfn.py b/tests/test_cfn.pyindex e32503c1..b1ea44cb 100644--- a/tests/test_cfn.py+++ b/tests/test_cfn.py@@ -866,13 +866,12 @@ def test_cfn_iot_ca_certificate_lifecycle(cfn, iot_client):assert ei.value.response["Error"]["Code"] == "ResourceNotFoundException"-def test_cfn_iot_ca_certificate_adopts_existing_registration(cfn, iot_client):+def test_cfn_iot_ca_certificate_existing_registration_fails_the_stack(cfn, iot_client):"""A CA already registered out of band answers ResourceAlreadyExists whenthe stack's create re-registers the PEM (the certificate id is derived- from it). Create adopts that registration under the same id and brings it- to the declared state instead of failing the stack — the same idempotent- path a rollback replay of create takes. The adopted CA is owned by the- stack from then on, so it goes away with the stack."""+ from it). Real CloudFormation fails the create on a resource that already+ exists rather than adopting one the stack never created — and the+ out-of-band registration survives, untouched by the rollback."""pytest.importorskip("cryptography")from ministack.core.x509_utils import generate_ca@@ -887,25 +886,85 @@ def test_cfn_iot_ca_certificate_adopts_existing_registration(cfn, iot_client):"Status": "ACTIVE","AutoRegistrationStatus": "ENABLE",}}},- "Outputs": {"CaId": {"Value": {"Fn::GetAtt": ["CA", "Id"]}}},})- cfn.create_stack(StackName="cfn-iot-ca-adopt", TemplateBody=template)- stack = _wait_stack(cfn, "cfn-iot-ca-adopt")- assert stack["StackStatus"] == "CREATE_COMPLETE"- outputs = {o["OutputKey"]: o["OutputValue"] for o in stack["Outputs"]}- assert outputs["CaId"] == pre_id+ cfn.create_stack(StackName="cfn-iot-ca-exists", TemplateBody=template)+ stack = _wait_stack(cfn, "cfn-iot-ca-exists")+ assert stack["StackStatus"] in ("CREATE_FAILED", "ROLLBACK_COMPLETE"), stack["StackStatus"]- # Adopted and brought to the declared state, not re-registered.+ # The out-of-band CA is untouched: still registered, still INACTIVE.desc = iot_client.describe_ca_certificate(certificateId=pre_id)["certificateDescription"]- assert desc["status"] == "ACTIVE"- assert desc["autoRegistrationStatus"] == "ENABLE"+ assert desc["status"] == "INACTIVE"+ assert desc["autoRegistrationStatus"] == "DISABLE"- cfn.delete_stack(StackName="cfn-iot-ca-adopt")- _wait_stack(cfn, "cfn-iot-ca-adopt")- with pytest.raises(ClientError) as ei:- iot_client.describe_ca_certificate(certificateId=pre_id)- assert ei.value.response["Error"]["Code"] == "ResourceNotFoundException"+ cfn.delete_stack(StackName="cfn-iot-ca-exists")+ _wait_stack(cfn, "cfn-iot-ca-exists")+ # And it survives the failed stack's deletion too.+ assert iot_client.describe_ca_certificate(certificateId=pre_id)+ iot_client.delete_ca_certificate(certificateId=pre_id)+++def test_cfn_iot_ca_certificate_registration_config_and_mode_immutability(cfn, iot_client):+ """RegistrationConfig round-trips through the provisioner into+ DescribeCACertificate (it is the JITR provisioning config — the property a+ JITR CA exists for), RemoveAutoRegistration turns auto-registration off on+ update, and a CertificateMode change is refused the way CloudFormation's+ update-requires-replacement would replace it."""+ pytest.importorskip("cryptography")+ from ministack.core.x509_utils import generate_ca++ ca_pem, _ca_key = generate_ca(common_name="cfn-ca-regcfg")++ def template(mode, remove_auto=False):+ props = {+ "CACertificatePem": ca_pem,+ "Status": "INACTIVE",+ "AutoRegistrationStatus": "ENABLE",+ "CertificateMode": mode,+ "RegistrationConfig": {+ "RoleArn": "arn:aws:iam::123456789012:role/jitr-role",+ "TemplateName": "jitr-template",+ },+ }+ if remove_auto:+ props["RemoveAutoRegistration"] = True+ return json.dumps({+ "AWSTemplateFormatVersion": "2010-09-09",+ "Resources": {"CA": {"Type": "AWS::IoT::CACertificate",+ "Properties": props}},+ "Outputs": {"CaId": {"Value": {"Fn::GetAtt": ["CA", "Id"]}}},+ })++ cfn.create_stack(StackName="cfn-iot-ca-regcfg", TemplateBody=template("SNI_ONLY"))+ stack = _wait_stack(cfn, "cfn-iot-ca-regcfg")+ assert stack["StackStatus"] == "CREATE_COMPLETE"+ ca_id = {o["OutputKey"]: o["OutputValue"] for o in stack["Outputs"]}["CaId"]++ got = iot_client.describe_ca_certificate(certificateId=ca_id)+ assert got["registrationConfig"] == {+ "roleArn": "arn:aws:iam::123456789012:role/jitr-role",+ "templateName": "jitr-template",+ }++ # RemoveAutoRegistration on an update turns auto-registration off.+ cfn.update_stack(StackName="cfn-iot-ca-regcfg",+ TemplateBody=template("SNI_ONLY", remove_auto=True))+ assert _wait_stack(cfn, "cfn-iot-ca-regcfg")["StackStatus"] == "UPDATE_COMPLETE"+ desc = iot_client.describe_ca_certificate(certificateId=ca_id)[+ "certificateDescription"]+ assert desc["autoRegistrationStatus"] == "DISABLE"++ # A CertificateMode change cannot be applied in place; the update fails+ # and rolls back, the stored mode untouched.+ cfn.update_stack(StackName="cfn-iot-ca-regcfg", TemplateBody=template("DEFAULT"))+ stack = _wait_stack(cfn, "cfn-iot-ca-regcfg")+ assert stack["StackStatus"] == "UPDATE_ROLLBACK_COMPLETE"+ desc = iot_client.describe_ca_certificate(certificateId=ca_id)[+ "certificateDescription"]+ assert desc["certificateMode"] == "SNI_ONLY"++ cfn.delete_stack(StackName="cfn-iot-ca-regcfg")+ _wait_stack(cfn, "cfn-iot-ca-regcfg")def test_cfn_iot_ca_certificate_pem_change_refused(cfn, iot_client):diff --git a/tests/test_iot.py b/tests/test_iot.pyindex 87413e58..0e71d138 100644--- a/tests/test_iot.py+++ b/tests/test_iot.py@@ -5248,6 +5248,39 @@ def test_iot_register_ca_certificate_mode_round_trip(iot_client):iot_client.delete_ca_certificate(certificateId=ca_id)+def test_iot_ca_certificate_registration_config_round_trip(iot_client):+ """registrationConfig rides Register and Update and comes back as+ DescribeCACertificate's top-level member — the JITR provisioning config."""+ ca_pem, _leaf = _generate_ca_and_leaf()+ cfg = {"roleArn": "arn:aws:iam::123456789012:role/jitr",+ "templateName": "jitr-template"}+ ca_id = iot_client.register_ca_certificate(+ caCertificate=ca_pem, allowAutoRegistration=True, registrationConfig=cfg+ )["certificateId"]++ got = iot_client.describe_ca_certificate(certificateId=ca_id)+ assert got["registrationConfig"] == cfg+ assert got["certificateDescription"]["autoRegistrationStatus"] == "ENABLE"++ # Update replaces the config, and removeAutoRegistration turns+ # auto-registration off.+ new_cfg = {"roleArn": "arn:aws:iam::123456789012:role/jitr-v2",+ "templateBody": "{}"}+ iot_client.update_ca_certificate(+ certificateId=ca_id, registrationConfig=new_cfg, removeAutoRegistration=True+ )+ got = iot_client.describe_ca_certificate(certificateId=ca_id)+ assert got["registrationConfig"] == new_cfg+ assert got["certificateDescription"]["autoRegistrationStatus"] == "DISABLE"++ # A CA registered without a config omits the member entirely.+ iot_client.delete_ca_certificate(certificateId=ca_id)+ ca_id = iot_client.register_ca_certificate(caCertificate=ca_pem)["certificateId"]+ assert "registrationConfig" not in iot_client.describe_ca_certificate(+ certificateId=ca_id)+ iot_client.delete_ca_certificate(certificateId=ca_id)++def test_iot_jitr_registered_event_published_when_auto_registration_enabled():"""Register a CA with auto-registration ENABLE, subscribe on``$aws/events/certificates/registered/#``, register a device cert under