* feat(cognito): add cognito overrides for client-id and secret. some boy-scouting
* feat(cognito): update docs, clarify reserved tags and possible values. Throws exception when unknown reserved tags are used.
* feat(cognito): reverted pom changes, align errorCode, use cleaned tag value
* feat(cognito): fix region resolver initialization
onStop() flushed storage last, after the slow proxy/container teardown, so a graceful shutdown could be cut off by the SIGTERM grace window before buffered hybrid data was written (e.g. ECS clusters lost across a restart). Flush first; keep shutdownAll() at the end. Adds an EmulatorLifecycle ordering-guard test. Refs #1521.
The ECS model records PortMapping, KeyValuePair, MountPoint, Volume, EfsVolumeConfiguration and NetworkBinding lacked @RegisterForReflection, so the native image could not Jackson-serialize task definitions to persistent storage ("No serializer found ... no properties discovered") when flushing ecs-task-definitions.json. The persisted ECS classes were already registered; these nested records were missed. Works under the JVM; fails only in the native image.
* feat(ses): implement PutConfigurationSetDeliveryOptions for SES v1
The classic SES Query API action was unhandled — only the v2 REST path
reached the existing setConfigurationSetDeliveryOptions service logic.
Route the v1 action through SesQueryHandler and register it in the
AwsQueryController SES action set.
The v1 DeliveryOptions structure carries only TlsPolicy (Require/Optional);
Floci stores the v2 canonical REQUIRE/OPTIONAL, so the handler normalizes
the value before delegating to the shared, already-validated service. An
all-null payload passes null to clear the block, mirroring the v2 path
rather than persisting an empty object.
Tests: v1 Query integration coverage (success, unknown set, invalid TLS
policy) and an AWS Java SDK v1 compatibility test that writes Require via
the v1 SesClient and reads it back as the canonical REQUIRE through v2
GetConfigurationSet, asserts an empty put clears the block, and asserts
the modeled ConfigurationSetDoesNotExistException for an unknown set.
* fix(ses): return v1 ValidationError for an invalid delivery-options TlsPolicy
The v1 PutConfigurationSetDeliveryOptions surfaced the shared service's
v2-style BadRequestException for an invalid TlsPolicy, so a v1 SDK could only
map it to a generic exception. Validate Require/Optional (case-sensitive) in
the v1 handler and throw the Smithy enum ValidationError AWS actually returns.
Verified against real AWS: an invalid or wrong-case TlsPolicy returns
ValidationError "1 validation error detected: Value at
'deliveryOptions.tlsPolicy' failed to satisfy constraint: Member must satisfy
enum value set: [Optional, Require]". The v1 integration test now asserts that
shape; valid Require/Optional still normalize to the canonical value for the
shared service.
DeleteStack swallowed every resource-deletion failure and always reported
DELETE_COMPLETE. Deleting a stack that owned a non-empty AWS::S3::Bucket
therefore "succeeded" while the bucket and its objects were left behind,
which diverges from AWS (S3 refuses to delete a non-empty bucket, so the
stack must end in DELETE_FAILED).
- CloudFormationResourceProvisioner#delete no longer wraps resource deletion
in a catch-all; failures propagate to the stack-level handler. The lenient
*Safe helpers and the intentional KMS key no-op are preserved.
- CloudFormationService#deleteStackResources now records per-resource
failures: the resource is marked DELETE_FAILED with a reason and event,
remaining resources are still attempted, and the stack settles into
DELETE_FAILED (retaining the stack and its exports) instead of being
reported as deleted. Resources left in DELETE_FAILED are re-attempted on a
subsequent delete, matching AWS retry behavior.
This corrects the same silent-success deviation for every managed resource
type, not just S3 buckets.
Adds a Java integration regression test and AWS CLI compatibility tests
covering both the non-empty (DELETE_FAILED) and empty (DELETE_COMPLETE)
bucket cases.
Fixes#1539
* feat(ecs): mount efsVolumeConfiguration task volumes as shared local volumes
ECS task definitions can declare EFS-backed volumes via
`efsVolumeConfiguration`, but Floci modelled only `host` volumes — an EFS
volume's mountPoint resolved to no source path and was skipped, so the
container launched without the mount. Terraform/ECS workloads that rely on
a shared EFS working directory (e.g. provisioner tasks reading/writing
/mnt/efs) had no filesystem at the mount path.
Parse and round-trip `efsVolumeConfiguration` (fileSystemId, rootDirectory,
transitEncryption, transitEncryptionPort, authorizationConfig) in
Register/DescribeTaskDefinition, and materialise an EFS volume as a shared
local Docker named volume `floci-efs-<fileSystemId>` mounted at the
container path (read-only/read-write per the mountPoint). Containers that
mount the same file system share persistent storage that survives task
restarts — the local stand-in for an EFS mount, since Docker cannot mount a
real EFS file system. This mirrors the documented LocalStack EFS-simulation
pattern at the ECS layer.
Tests cover the volume->named-volume resolution by access mode and the
efsVolumeConfiguration JSON round-trip.
* chore: re-trigger CI
Unrelated flaky CodeBuildTest.batchGetBuilds_eventuallySucceeds; root-cause
fix in floci-io/floci#1577.
* fix(iam): resolve AWS-managed policies from any account context
AWS-managed policies (arn:aws:iam::aws:policy/...) are global — not owned by
any account — but they were seeded into the account-partitioned policy store at
startup under the default account only. A caller in any other account (e.g. an
assumed-role / 12-digit access-key credential) got NoSuchEntity from GetPolicy,
breaking Terraform's `data "aws_iam_policy"` lookups of managed policies such as
AWSLambdaBasicExecutionRole and AmazonECSTaskExecutionRolePolicy.
Serve managed policies from a global in-memory catalog keyed by ARN, built once
from AwsManagedPolicies, so getPolicy (and the version/tag reads that route
through it) resolve them for any caller regardless of account. The catalog is
still mirrored into the default-account store so ListPolicies(Scope=AWS) keeps
listing them.
Also add three commonly-attached managed policies: AWSCloudFormationFullAccess,
AWSXRayDaemonWriteAccess, AmazonElasticFileSystemClientFullAccess.
* fix(iam): list AWS-managed policies from the global catalog for any account
ListPolicies(Scope=AWS) and Scope=All scanned only the request account's
partition, so AWS-managed policies (mirrored into the default account at seed
time) were invisible to callers in any other account — the same account-scoping
bug already fixed for GetPolicy in this PR. It also broke name lookup, since
data.aws_iam_policy resolves through ListPolicies plus a name filter.
Serve managed policies from the global awsManagedPolicies catalog for the AWS
and All scopes, and exclude managed ARNs from the account scan so the default
account does not list them twice. GetPolicy and ListPolicies now line up.
CodeDeploy held applications, deployment groups, deployment configs, on-premises
instances and resource tags in plain in-memory maps, so all of them were lost on
restart while every other persistent service survived. Back these stores with
StorageFactory (region descriptor + flush interval wired through EmulatorConfig and
application.yml), re-wrap loaded inner maps as ConcurrentHashMap for thread-safe
per-key mutation, write inner-map mutations back so StorageBackedMap flushes them,
and reconcile built-in deployment configs on load. Deployments and other runtime
state remain in memory by design.
Redpanda embeds broker addresses in Kafka protocol responses (Metadata,
FindCoordinator, ...) and clients reconnect directly to whatever address
it advertises. Without --advertise-kafka-addr, Redpanda advertised its
self-perceived loopback (127.0.0.1:9092), which is unreachable from any
external client — host-side or sibling container.
Resolve and pass the externally reachable address explicitly: a
pre-allocated localhost:<port> in native mode (the host port must be
known before the container starts), or <containerName>:9092 — resolved
via Docker's embedded DNS — in container mode.
* feat(pipes): support Kafka pipe sources and polling
Add EventBridge Pipes support for Amazon MSK and self-managed Kafka sources exposed via `smk://`.
Introduce Kafka consumer management for bootstrap resolution, consumer group selection, topic validation, and safe reuse across poll cycles.
Extend the Pipes poller and tests to filter decoded Kafka payloads, deliver the expected record shape, and commit offsets only after successful delivery.
* fix(pipes): tighten Kafka validation and commit handling
Clarify Kafka validation errors, avoid duplicate Kafka record transformation, commit delivered Kafka offsets per partition for non-Lambda targets, and remove reflective poller test access.
* fix(pipes): stabilise Kafka poller event handling
Use a consistent Kafka partition type, narrow JSON decode error handling, remove reflection from manager tests, and tighten no-commit assertions for failed Kafka delivery paths.
* fix(pipes): preserve Kafka nulls and commit progress
Preserve null Kafka key and value fields, encode Kafka headers consistently, and commit Lambda Kafka progress per partition so successfully processed records are not replayed after later failures.
* fix(msk): align broker metadata and Kafka event payloads
* fix: implement read APIs required by Steampipe resource collection
IAM ListMFADevices, ECR BatchGetRepositoryScanningConfiguration, and CloudWatch Logs GetDataProtectionPolicy returned UnsupportedOperation (400). Each is invoked per-item by the Steampipe AWS plugin to enrich aws_iam_user, aws_ecr_repository, and aws_cloudwatch_log_group; the 400 aborted the whole table hydration, so those tables collected zero rows against Floci.
Implement minimal, wire-accurate responses:
- IAM ListMFADevices -> empty MFADevices list (IsTruncated=false)
- ECR BatchGetRepositoryScanningConfiguration -> reuse describeRepositories, return MANUAL scan config
- CloudWatch Logs GetDataProtectionPolicy -> empty policy at HTTP 200 (the steampipe aws plugin hydrate does not tolerate ResourceNotFound, so 200 is required for collection to succeed)
Adds focused tests for each handler.
* docs: ground read-API handler comments in AWS wire behavior
Rewrite the ListMFADevices, BatchGetRepositoryScanningConfiguration, and
GetDataProtectionPolicy handler comments to describe real AWS response shapes,
enum values, and error semantics (NoSuchEntity 404, scanFrequency enum,
ResourceNotFoundException 400) instead of referencing a specific consumer.
Note the known deviations (200-empty vs error, batch-fail vs failures[]).
* fix: return XML error for missing action and add volume action fallbacks
* fix(eventbridge): sync EventBridge tags to ResourceGroupsTaggingService
EventBridge stored tags on rules, buses, and archives in its own stores but never propagated them to the central ResourceGroupsTaggingService. This caused GetResources with --resource-type-filters events:rule to return an empty list.
Inject ResourceGroupsTaggingService into EventBridgeService (following the existing GlueService pattern) and sync tags during putRule, tagResource, untagResource, and deleteRule operations.
Closes#1343
* fix(lambda): use persisted firstReceiveTimestamp in SQS ESM and Pipes event payloads
Both SqsEventSourcePoller.buildSqsEvent() and PipesPoller.buildSqsRecordNodes()
were using System.currentTimeMillis() for ApproximateFirstReceiveTimestamp,
causing the value to change on every poll cycle. AWS SQS defines this as the
epoch time when the message was first received from the queue, and it must
remain constant across retries.
The SQS service layer already tracks this correctly via
Message.firstReceiveTimestamp (set once in GuardedMessageQueue.tryClaim()),
but both pollers bypassed the stored value.
Changes:
- SqsEventSourcePoller: read msg.getFirstReceiveTimestamp() with null fallback
- PipesPoller: same fix for the identical code path
- SqsEventSourcePollerTest: set firstReceiveTimestamp on test messages and
assert the output matches the stored value; add a regression test proving
the timestamp remains stable across simulated retries
Closes#1497
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
The build container was started with a fire-and-forget entrypoint
("mkdir -p /codebuild/output/src/src && tail -f /dev/null"). createAndStart
returns as soon as the container is running, which can be before that mkdir
completes. The runner then immediately execs the build phases (which chdir
into the directory) and copies artifacts out of it, so on a slow container
start the directory does not exist yet: the BUILD exec fails and the artifact
copy 404s, and the build is reported as FAILED.
Drop the mkdir from the entrypoint and create the working directory with an
explicit, awaited "mkdir -p" exec (run from "/", which always exists) before
the source copy and the phases. This removes the race.
This was surfacing as the intermittent failure of
CodeBuildTest.batchGetBuilds_eventuallySucceeds in the sdk-test-java
compatibility suite.
When an SQS event source mapping invokes a Lambda from a FIFO queue,
copy MessageGroupId, SequenceNumber, and MessageDeduplicationId into
each record's attributes map, matching the values ReceiveMessage
already returns. Standard-queue messages are unaffected.
Closes#1526
A Node/file-based handler can be given with a leading "./" — e.g.
"./v1/lambda-handlers/entry.handler", as the terraform-aws-modules/lambda module
(and DPS) emit. resolveHandlerFilePath stripped only the ".handler" export
suffix, leaving "./v1/lambda-handlers/entry", which never matched the
deployment-package entry "v1/lambda-handlers/entry.js" (stored without the
"./"). CreateFunction then rejected the function with
"Handler file '...' not found in deployment package".
Normalize a leading "./" away before matching the handler against the package.
* fix(rds): align subnet group placement handling with AWS behavior
* fix(rds): align DB subnet group wire responses with AWS model
* fix(rds): align subnet group placement validation with AWS
* fix(rds): tighten subnet group placement validation
* chore: rerun ci
The storage backend hands every caller the same entity instance, and
IamService mutates that entity's collections in place before storing it
back (getInlinePolicies().put(...), getAttachedPolicyArns().add(...), etc.)
with no synchronization. When two requests touch the same entity at once -
e.g. Terraform applying many aws_iam_role_policy resources under
-parallelism - the plain HashMap/ArrayList lose entries and corrupt their
internal tables. PutRolePolicy returns success but the immediate
GetRolePolicy then reports NoSuchEntity (so the provider's create-waiter
exhausts and the apply fails), and listRolePolicies can throw
ArrayIndexOutOfBoundsException off the corrupted map.
Make the shared collections concurrency-safe across all IAM entities:
ConcurrentHashMap for tag and inline-policy maps, CopyOnWriteArrayList for
the user/group/role/instance-profile lists, with defensive setters so a
Jackson rehydrate from disk can't swap a plain collection back in.
Policy versions keep insertion order via a synchronized LinkedHashMap, and
the compound check-then-act paths that a thread-safe collection alone can't
make atomic are guarded explicitly: createPolicyVersion (version id derived
from size()+1), delete/setDefaultPolicyVersion, listPolicyVersions, and the
single-role cap in addRoleToInstanceProfile.
Add concurrency tests that drive each collection from many threads and
assert no entry is lost or corrupted; they fail reliably before the fix.
* fix(s3): serve custom error document for missing keys in static website hosting
When a bucket has a website configuration with an ErrorDocument, requests
to missing keys now return the error document with a 404 status instead
of the default XML NoSuchKey error.
* fix(test): handle null output in waitForExecution to prevent flaky CI failures
* fix(s3): address review feedback on static website hosting
* fix(s3): recognize s3-website hostnames in virtual host filter
* fix(s3): gate website error document on website endpoint host
* fix(s3): restore validateRawUri inside try block after rebase
CloudFrontService hardcoded the ".cloudfront.net" suffix when generating
distribution domain names, so the existing floci.services.cloudfront.domain-suffix
config (FLOCI_SERVICES_CLOUDFRONT_DOMAIN_SUFFIX) had no effect.
Read config.services().cloudfront().domainSuffix() into the service and use it
in createDistribution() and createStreamingDistribution(). The default remains
cloudfront.net via @WithDefault, so existing behaviour is unchanged.
Adds CloudFrontServiceTest covering the default suffix and a configured override
for both distributions and streaming distributions.
Wire SetIdentityNotificationTopic into the send path so a verified
identity (or its parent domain) with a Bounce/Complaint/Delivery topic
receives an Amazon SNS notification when a matching event occurs,
independently of any configuration set. Previously the topic ARN was
stored and only echoed back by GetIdentityNotificationAttributes.
The notification uses the legacy notificationType payload format, which
shares the mail/bounce/complaint/delivery blocks with event publishing
but differs in three spec-mandated ways: the top-level discriminator is
named notificationType instead of eventType; the mail object omits the
tags field; and the original headers (headers/commonHeaders/
headersTruncated) are included only when the identity has
headers-in-notifications enabled for the notification type.
The sending identity is resolved from the bare email address (so a
display-name Source yields a valid identity/<email> ARN), and SendRawEmail
falls back to the MIME From header when Source is omitted, using that
effective source consistently for the stored message, SMTP relay, and
event publishing. RawMessageHeaders now parses the From address.
Docs: documented the behavior in docs/services/ses.md.
* fix: return XML error for missing action and add volume action fallbacks
* fix(eventbridge): sync EventBridge tags to ResourceGroupsTaggingService
EventBridge stored tags on rules, buses, and archives in its own stores but never propagated them to the central ResourceGroupsTaggingService. This caused GetResources with --resource-type-filters events:rule to return an empty list.
Inject ResourceGroupsTaggingService into EventBridgeService (following the existing GlueService pattern) and sync tags during putRule, tagResource, untagResource, and deleteRule operations.
Closes#1343
* fix(lambda): populate SQS messageAttributes in Lambda event payload
buildSqsEvent() was calling record.putObject("messageAttributes") which
creates an empty JSON object node and discards msg.getMessageAttributes()
entirely. Lambda functions receiving SQS events always saw an empty
messageAttributes map regardless of what was sent with the message.
Fix serializes each MessageAttributeValue into the AWS-specified shape:
{ dataType, stringValue, binaryValue, stringListValues, binaryListValues }
Binary values are base64-encoded per the Lambda SQS event contract.
md5OfMessageAttributes is now forwarded to the record when present.
Added four new unit tests covering: String, Number, and Binary attribute
types, multiple messages each with independent attributes, and the
no-attributes case (backward compat: empty object, no md5 field).
Fixes#1411
* fix: serialize only populated SQS message attribute values
* fix: omit null scalar fields from SQS message attributes in Lambda event payload
- Stop emitting explicit JSON nulls for absent stringValue/binaryValue
fields in SqsEventSourcePoller.buildSqsEvent(); AWS Lambda omits
these entirely rather than sending null.
- Align serialization order with PipesPoller: check binaryValue first,
then stringValue via else-if.
- Update test assertions to expect key-absent (assertNull) instead of
null-JSON-node (isNull) for the unpopulated scalar field.
RotateSecret invoked the Lambda rotation function without first
registering the ClientRequestToken as an AWSPENDING version. Standard
rotation handlers (including the AWS-provided templates) call
DescribeSecret and expect to find their token in VersionIdsToStages,
causing rotation to fail with:
ValueError: Secret version <token> has no stage for rotation.
Create an empty AWSPENDING placeholder version keyed by the
ClientRequestToken before invoking the Lambda's createSecret step.
This matches the behavior of real AWS and Moto.
Also allow PutSecretValue to overwrite an AWSPENDING placeholder that
has no secret value yet, since the Lambda's createSecret step needs to
populate it.
Pressing 'Open Floci UI' under Podman (docker-socket compat) reports every
failure as a missing image and tells the user to 'docker pull floci-ui' — even
when the image is present. The real causes (an unreachable Docker/Podman socket,
a port clash, a daemon error) are hidden, which is especially confusing on
SELinux hosts where the bind-mounted socket connect fails with
'java.net.BindException: Permission denied'.
Classify the failure in FlociUiManager.describeStartFailure:
- only a genuinely unavailable image (NotFoundException / docker-java's
'Could not pull image: ...' wrapper) keeps the 'docker pull' guidance;
- an unreachable runtime (SocketException/BindException/ConnectException) points
at the socket mount and SELinux relabeling;
- any other daemon error is surfaced as-is (e.g. 'address already in use').
Also fix the Podman docs: use ':z' (shared relabel) rather than ':Z' on the
shared Podman API socket, note it applies to the UI sidecar, and mention the
'--security-opt label=disable' fallback.
Add unit tests for the four classifications.
- emit routeTableIdSet/subnetIdSet items as plain text (AWS SDK for Go could not
deserialize the wrapped form)
- add DescribePrefixLists returning managed S3/DynamoDB prefix lists
- honor private_dns_enabled (default true for interface endpoints)
Adds Ec2IntegrationTest coverage and documents the new actions.
* fix(floci-ui): resolve readiness probe URL from container endpoint
Resolve the floci-ui readiness probe URL once at start/adopt time from the
sidecar's resolved EndpointInfo instead of branching on container detection
each probe. EndpointInfo already returns a Floci-reachable address —
localhost:hostPort natively, or the sidecar's container IP on the shared
Docker network when Floci runs in a container, where the published host port
is unreachable from inside.
* fix(floci-ui): set hostPort from bound endpoint natively, keep configured port in container
Address PR review: EndpointInfo.port() is the real host binding only in native
mode (and reflects dynamic port=0 allocation there). In container mode it is the
sidecar's internal port (4500), so the configured published port stays
authoritative for the browser redirect. Extract resolveHostPort() and use it in
both ensureStarted() and adoptExisting().
* fix(ec2): added user data output streaming to cloud watch
* fix(ec2): deleted dead code after merging
* fix(ec2): adjust comments position
* fix(ec2): fixed userdata logging and added mockito tests
Back the durable AWS Config maps with StorageFactory so they survive a restart
instead of living only in memory. configRules and conformancePacks use the
nested-region pattern (re-put after inner-map mutation); configurationRecorders,
deliveryChannels and tags swap to flat StorageBackedMaps with tag inner-map
write-backs. Recorder run-state stays in memory. Storage key is config. Wire
ConfigStorageConfig + catalog descriptor + application.yml.
Back the region-nested projects, report groups and source credentials maps
with StorageFactory-backed maps (ELBv2 nested-region pattern) so they survive
a restart instead of living only in memory. Re-put the region entry after
inner-map create/update/delete so the periodic flush captures the change.
Builds and build counters stay in memory as runtime state. Wire
CodeBuildStorageConfig + catalog descriptor + application.yml.
Back clusters, task definitions, latest revisions, services, capacity
providers, attributes and account settings with StorageFactory-backed
maps so they survive a restart instead of living only in memory. Add
write-backs at in-place mutation sites (cluster config/counters, service
config/status, task-definition status, tags, attributes) so the periodic
flush captures them; transient runtime state (tasks, task sets,
deployments, container instances) stays in memory. Wire EcsStorageConfig
+ catalog descriptor + application.yml.
* fix: return XML error for missing action and add volume action fallbacks
* fix(eventbridge): sync EventBridge tags to ResourceGroupsTaggingService
EventBridge stored tags on rules, buses, and archives in its own stores but never propagated them to the central ResourceGroupsTaggingService. This caused GetResources with --resource-type-filters events:rule to return an empty list.
Inject ResourceGroupsTaggingService into EventBridgeService (following the existing GlueService pattern) and sync tags during putRule, tagResource, untagResource, and deleteRule operations.
Closes#1343
* feat(secretsmanager): implement automatic secret rotation lifecycle
* fix(secretsmanager): correct RotationLambdaARN validation in tests and rotation rules parsing
* fix(secretsmanager): avoid implicit unboxing NPE when parsing rotation rules
* fix: remove debug print, drop camelCase rotation parameters fallback, and revert unrelated eventbridge changes
* fix: align PutSecretValue error code and resolve NPE in JSON handler tests
* fix(test): create Lambda function before rotateSecret to fix ResourceNotFoundException
rotateSecretStub failed because SecretsManagerService validates the
rotation Lambda exists synchronously. The test was passing an ARN for a
function that had never been created in the emulator.
Create a real Lambda function via LambdaClient before calling
rotateSecret, and clean it up afterwards. Uses
Runtime.fromValue(nodejs20.x) for SDK compatibility.
* fix: non-immediate rotation runs testSecret only
Per AWS RotateSecret docs, when RotateImmediately is false Secrets
Manager tests the rotation configuration by running only the testSecret
step. Remove the createSecret invocation from the non-immediate path.
* fix(test): align rotateSecretNotImmediate with non-immediate rotation path
The non-immediate rotation path only invokes testSecret (not createSecret),
so the test should expect 1 lambda invocation instead of 2.
Implements CreateNetworkAcl, DescribeNetworkAcls (with vpc-id / default /
association.subnet-id filters), CreateNetworkAclEntry, ReplaceNetworkAclEntry,
DeleteNetworkAclEntry, ReplaceNetworkAclAssociation, and DeleteNetworkAcl.
Every VPC is provisioned with a default NACL and each subnet is associated with
it, so aws_network_acl and aws_default_network_acl work via Terraform.
Adds Ec2IntegrationTest coverage and documents the new actions.