mirror of
https://github.com/floci-io/floci.git
synced 2026-12-02 09:47:56 -05:00
7dc514b52f2c96bdd1ea32ae64a02703f85be2aa
38
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ee2d1a68a6 |
feat(cloudformation): pass Lambda DurableConfig through (#5218)
* feat(cloudformation): pass Lambda DurableConfig through AWS::Lambda::Function.DurableConfig reaches CreateFunction and UpdateFunctionConfiguration. As on AWS, a RetentionPeriodInDays the template leaves out is 14 on update too, a durable function created without Timeout gets min(ExecutionTimeout, 900), and adding or removing DurableConfig replaces the function. * test(terraform): cover aws_lambda_function durable_config The provider creates a durable function, reads it back without a diff, updates execution_timeout in place, and before destroy stops a RUNNING durable execution through ListDurableExecutionsByFunction, StopDurableExecution and GetDurableExecution. * fix(cloudformation): honor AWS::NoValue, cleared keys and large numbers in DurableConfig A DurableConfig that Fn::If removes with AWS::NoValue leaves the function plain. A KMSKeyArn the template leaves out or sets to "" clears the key, as CloudFormation does on AWS, since Lambda keeps a stored key when the update omits the member. A number beyond an integer reaches Lambda unchanged, so its range check rejects it. * fix(cloudformation): reject a DurableConfig that is not an object Only an intrinsic that resolves to AWS::NoValue removes DurableConfig. CloudFormation rejects a string, number or list in its schema check before the function is touched, so an update with one no longer replaces and deletes a durable function. * test(cloudformation): cover Lambda DurableConfig with the AWS SDK The CloudFormation and Lambda SDK clients create a durable function, update DurableConfig in place, and remove it by replacing the function. * fix(cloudformation): require ExecutionTimeout and known members in DurableConfig CloudFormation checks DurableConfig against the schema on update too: an update without ExecutionTimeout, or with a member the schema does not list, fails before the function is touched. Floci let such an update through and kept the old timeout. * refactor(cloudformation): look up a Lambda function once per deploy The name choice and the replacement decision now share one lookup and one durable check, so they cannot disagree. |
||
|
|
7cf8ab7d85 |
feat(ce): manage anomaly monitors and subscriptions (#4221)
* feat(ce): manage anomaly monitors and subscriptions * fix(ce): return JSON objects for empty responses |
||
|
|
684239b0ef |
fix(elasticache): create single-node redis clusters and close provisioning races (#3634)
* feat(elasticache): support single-node redis clusters in CreateCacheCluster CreateCacheCluster refused every engine but memcached, telling callers to use CreateReplicationGroup instead. Real AWS accepts Engine=redis and Engine=valkey there as long as the cluster has one node, and that is exactly the call terraform's aws_elasticache_cluster with engine = "redis" emits, so every such example failed against Floci. A single-node redis or valkey cluster is now provisioned the way a cluster-mode-disabled replication group is: the same Valkey container, fronted by the same auth proxy on a port from the same range, so the endpoint a describe reports actually answers RESP. It is stored apart from replication groups, since one created this way has none and must not appear in DescribeReplicationGroups. NumCacheNodes greater than 1 is refused with the message a live account gives. Following AWS, the cluster carries no ConfigurationEndpoint (that is memcached's node discovery endpoint) and reports its node under CacheNodes when the request sets ShowCacheNodeInfo, which is where terraform-provider-aws reads the port. The memcached path is unchanged. ElastiCacheMemcachedIntegrationTest asserted the old refusal with Engine=redis; it now asserts it with an engine ElastiCache really does not have. * fix(elasticache): address review findings Cross-type id collision closed both directions through one provisioningIds claim set (the claimed thing is one namespace: container name + proxy key); wire code corrected to CacheClusterAlreadyExists; create request grown to round-trip the optional members Terraform reads back, guarded by a compat-terraform bats config asserting plan -detailed-exitcode after apply; ListTagsForResource cluster arm brought to parity with the replicationgroup arm without regressing memcached/member fall-through; standalone clusters join getResources; create/delete responses no longer leak CacheNodes. * fix(elasticache): correct review-round test assertion, bats port pin, docs note The cross-type guard test asserted never() on a tryStart its own setup legitimately performs — times(1), matching the sibling test. The single-node bats config pinned port 6379, which the parallel bats runner's sibling replication-group config fills first from the range base (the allocator refuses rather than substitutes) — pinned to 6395. AtRestEncryptionEnabled noted in docs as output-only on real AWS's CreateCacheCluster. * docs(elasticache): the output-only note belongs to the single-node prose, not the CreateReplicationGroup row AtRestEncryptionEnabled is a legitimate input member of CreateReplicationGroupMessage; it is absent only from CreateCacheClusterMessage. * fix(elasticache): reserve persisted ports on restore, cross-store id uniqueness, validate subnet group Three findings from the PR review, all on the single-node cache cluster path. Ports of records that survive a restart are now reserved before Floci serves anything. Standalone cache clusters and cluster-mode-disabled replication groups are not re-provisioned, but they still advertise the port they were given, and nothing put those ports back into the in-use set: a create after a restart was handed a port a live record still published, and the two then contended over one reservation, so the first delete freed it and the next create took it again. A delete now releases only a port this process actually reserved for that record, since a restored record whose port was already taken advertises one it does not own. The id check spans all three stores that answer DescribeCacheClusters. A standalone redis cluster, a Memcached cluster and a replication group can no longer share an id in either direction. Both services read the same backends: StorageFactory keys them by file path and hands the second caller the first caller's instance, so no new wiring is needed for the two services to agree on one namespace. CacheSubnetGroupName must now name a subnet group that exists, instead of being stored as a reference a describe reports and a caller cannot look up. CreateReplicationGroup still does not make that check; it is called out in the service and in the docs rather than changed here. * style(elasticache): drop em dash in transient-field comment * fix(elasticache): close the id and port gaps the delta review found CreateReplicationGroup's duplicate-id check read only the group and redis cluster stores, so a group could take the id of a live memcached cluster while CreateCacheCluster refused the same collision the other way round. Check the third store too, which is what makes the documented "an id is taken across all three at once" actually hold. Two port-reservation fixes alongside it. The claim on a new cache cluster's port was recorded after the synchronized block that stores the record, so a delete landing in the gap found nothing to release and stranded the reservation; it now happens under the same monitor as the put. And deleteReplicationGroup freed the group's port unconditionally, while the cluster path has guarded that since the restore work went in: a record restored from disk whose port was already taken advertises a port it does not own, and freeing it hands a live record's port to the next create. The holder set now covers both kinds, keyed by id, which is safe because an id is unique across the stores. * docs(elasticache): say which engines the subnet-group check covers CreateCacheCluster with Engine=memcached routes to a create that takes only the cluster id, so CacheSubnetGroupName is dropped on that path: not checked, not echoed. The page claimed the check unqualified. Also name CreateReplicationGroup in the id-uniqueness paragraph, now that it makes the same check. * test(elasticache): cover the ordinary group delete that frees its port The two port tests around it both step past the create path: one deletes a group written straight into the store, the other one restored after a restart. So the claim recorded when a group is created in process had nothing behind it, and dropping it would leave the suite green while every DeleteReplicationGroup leaked its proxy port for the life of the process. * fix(elasticache): claim the id on the memcached create path too CreateCacheCluster for memcached checked the three stores for a duplicate id and went straight on to start its container, without joining the in-flight claim set the redis cluster and replication group paths take. No create path persists its record until after container startup, so a memcached create and a redis create for one id could both read three empty stores and both write, leaving the id in two stores with DescribeCacheClusters reporting it twice and the two containers and proxy registrations colliding under one name. Move that set out of ElastiCacheService into an ElastiCacheProvisioningIds bean both services inject, so the claim covers every engine, and take it in the memcached path before the store checks with the same try/finally release. A collision with an in-flight create is refused with the fault the store-hit path already produces, CacheClusterAlreadyExistsFault. * fix(elasticache): complete the CacheNode shape and correct the memcached fault code DescribeCacheClusters returned a CacheNode carrying only an id, a status and an endpoint. terraform-provider-aws dereferences CacheNodeCreateTime and ParameterGroupStatus while adopting the resource without a nil check, so the compat-terraform job created floci-tf-redis-single successfully and then died on the very next refresh with "Unexpected nil pointer" naming both fields. The endpoint was never the problem; the node shape was incomplete. Both are stable metadata AWS returns on every available node, and both were already known here: a single-node cluster's node was created with the cluster, and its parameter group carries the same in-sync status already reported for the cluster. CustomerAvailabilityZone is emitted from the cluster's AZ for the same reason -- a node whose AZ disagrees with its cluster is a permanent plan diff. Memcached returns early well above this block, so its wire output is unchanged. Separately, the id claim added on the memcached create path threw CacheClusterAlreadyExistsFault. The wire code is CacheClusterAlreadyExists -- the Fault suffix is the botocore shape name, not the code an SDK matches on -- which this branch had already established on the redis side and then contradicted. Both memcached throw sites now use the wire code, including the pre-existing one, and the five test assertions that pinned the wrong spelling are corrected. * test(elasticache): stop the single-node fixture pinning the shared suite's port The compat-terraform job runs every stack against one Floci, and this branch's new elasticache-single-node-tf pinned port 6395 -- the same port main.tf already pins for the replication group the `terraform` suite creates. ElastiCache refuses a pinned port that is already reserved, by design, so the two stacks can only both succeed if the first is fully destroyed before the second applies. That is what the last run showed: elasticache_single_node failed its apply, so its destroy never ran, 6395 stayed held, and the `terraform` suite then failed with "Port 6395 is already in use by another replication group" -- a second failure that reads like an allocator bug and is really a fixture collision. Fixing the node shape removes the trigger but not the collision, which would remain a teardown-ordering dependency between two independent suites. 6396 is free and inside the 6379-6399 proxy range. * test(elasticache): name the extracted XmlPath instead of inferring it with var Review follow-up: this was the only `var` in the file, and the type it hides (io.restassured.path.xml.XmlPath) is the one a reader needs in order to follow the getString/getInt calls immediately below it. No behaviour change. * style(test): import ArrayList and LinkedHashMap instead of naming them inline AGENTS.md asks for imports rather than inline fully-qualified names. ElastiCacheQueryHandlerTest had three: new java.util.ArrayList<>(...) and two new java.util.LinkedHashMap<>(...). LinkedHashMap was already imported; ArrayList is added. |
||
|
|
5d23a70cc0 |
fix(dynamodb): honor MICROSECOND ApproximateCreationDateTimePrecision for Kinesis destinations and streams false enablement (#3874)
* fix(dynamodb): honor MICROSECOND ApproximateCreationDateTimePrecision for Kinesis destinations Store the precision requested in EnableKinesisStreamingConfiguration, echo it in the enable response, and return it from DescribeKinesisStreamingDestination, so Terraform no longer destroys and recreates the destination on every apply. Stamp ApproximateCreationDateTime in epoch microseconds for MICROSECOND destinations, with a shared eventID per change across destinations. Reject precisions other than MILLISECOND and MICROSECOND with ValidationException. Add forwarder unit and end-to-end integration coverage, and document the behavior. * fix(dynamodb): stop enabling DynamoDB Streams with a Kinesis destination EnableKinesisStreamingDestination turned on DynamoDB Streams for the table. Kinesis forwarding does not need it, and Terraform saw stream_enabled drift on aws_dynamodb_table on every run. Leave the table's stream setting as the caller configured it. * test(dynamodb): add Terraform compat test for Kinesis destination precision Apply a Kinesis streaming destination with MICROSECOND precision and check that it reads back, that a second plan is clean, and that a precision change replaces the destination once and then settles. |
||
|
|
004d562f34 |
fix(apigateway): return stored method, policy, and stage settings (#3857)
* fix(apigateway): return stored method, policy, and stage settings Store and return method request parameters, the REST API policy, and stage access log settings, tracing, and tags. These writes were accepted but never saved, so Terraform planned the same changes on every run. Support the patch paths Terraform uses for these fields. Return the policy escaped the same way AWS does. Tag stages by their own ARN instead of tagging the REST API. Add REST regression coverage. * test(apigateway): add Terraform compat test for REST read-back Apply a REST API gateway module with Terraform, then check that it converges. Check that the method, policy, and stage settings read back after apply. Check that a second apply succeeds and the plan after it has no changes. Check that changing a request parameter or a stage tag applies and re-plans clean. Use the deployment trigger hash from the bug report, which used to fail with "Provider produced inconsistent final plan". |
||
|
|
66bcdaf675 |
feat(codeartifact): add CodeArtifact control-plane support (#3713)
Floci had zero CodeArtifact support: no service package, no docs, nothing. Any terraform apply touching aws_codeartifact_domain, aws_codeartifact_repository, or either permissions-policy resource failed outright. This adds the full CodeArtifact control plane: domain and repository CRUD, resource policies with optimistic-locking revisions, tags, and the fixed set of real AWS-hosted external (upstream) connections (public:npmjs, public:pypi, public:maven-central, etc.). Package publish/fetch endpoints per format (npm, PyPI, Maven, NuGet, generic) are intentionally out of scope here: this closes the terraform apply gap, not real package serving. ListTagsForResource (POST /v1/tags?resourceArn=) is CodeArtifact's one tag operation that addresses the resource with a query parameter on the bare path rather than a path segment, unlike every other V1TagsController/SharedTagsController handler. That method lives on V1TagsController itself rather than the shared AbstractTagsController base: SharedTagsController (mounted at /tags) already declares its own bare POST (tagResourceByBody, for TagResource), so a bare POST on the shared base collides with it and Quarkus refuses to start. CodeArtifact's handler is @V1Tags-qualified and only ever registered against V1TagsController, so the method belongs there. core/common stays service-free: CodeArtifactTagHandler registers itself as a bean the same way MskTagHandler does, and TagHandler gained a default for the lowercase key/value entry names CodeArtifact uses instead of AWS's usual capitalized Key/Value. Known, documented limitations (see docs/services/codeartifact.md): no cycle detection across upstream chains, no referential-integrity check when deleting a repository other repositories reference as an upstream, and no authorization check on cross-account domainOwner addressing (consistent with Floci's opt-in IAM enforcement elsewhere). Verified against the real botocore codeartifact service-2.json (protocol, exact querystring vs. body placement per operation, exact ARN format, epoch-seconds timestamps, real error shapes) and the live AWS API docs for behavioral rules not in the wire model (DeleteDomain blocked while repositories exist, the real fixed external-connection name/format list, PutDomainPermissionsPolicy's all-body field placement vs. the sibling repository operation's querystring placement). Live-verified three ways: - Unit tests including a concurrent-create race test proving the synchronized guard actually holds under contention, plus full-stack QuarkusTest/RestAssured integration tests. - A real terraform init/apply/plan/destroy cycle against a running Floci instance, independently confirming destroy actually tore the domain down via a follow-up describe-domain call. - A live AWS SDK v2 Java test exercising the real CodeartifactClient against a live instance. |
||
|
|
32594a9dd5 |
ci: bound each terraform bats file and keep partial results on a cancelled compat job (#3720)
The arm64 compat-terraform job hangs about once in thirty runs and dies at the workflow's 20-minute timeout-minutes with nothing to show for it: the runner kept every per-file log and JUnit report in a temp dir inside the container until all files had finished, so a cancel discarded them, and the floci log was only dumped on failure, which a cancel is not. Three such timeouts in the last hundred runs, all with the same blank log. Each bats file now runs under timeout (BATS_FILE_TIMEOUT, default 12m, against a healthy run of about 6.5 minutes), without --foreground so the terraform children die with bats. A file that hits the limit exits 124 with a line naming it appended to its log, each file's report is published as soon as that file ends, a progress line per file reaches the console, and the floci log is dumped on cancel as well. Both suites' runners stay identical. |
||
|
|
c7b4a393d9 |
fix(rds): support IPV6 and DUAL network types on RDS Proxy (#3639)
CreateDBProxy/AWS::RDS::DBProxy rejected EndpointNetworkType/TargetConnectionNetworkType
outright for anything other than IPV4 ("Floci currently exposes IPv4 proxy networking only").
Both fields are now accepted and stored on the DbProxy record:
- EndpointNetworkType: IPV4, IPV6, or DUAL
- TargetConnectionNetworkType: IPV4 or IPV6 (no DUAL, matching AWS's own constraint)
They round-trip through DescribeDBProxies and CloudFormation the same way the proxy's other
control-plane settings (pool sizing, TLS, idle timeout) already did.
AWS's RDS Proxy network prerequisites require both the VPC and every selected subnet to carry
an associated IPv6 CIDR block for IPV6/DUAL. floci already modeled VPC-level IPv6 CIDR
associations; subnet-level association is now modeled too (Subnet.ipv6CidrBlockAssociationSet,
CreateSubnet's Ipv6CidrBlock parameter, and the DescribeSubnets/CreateSubnet response), and
createDbProxy validates both the VPC and every VpcSubnetIds entry before accepting a non-IPV4
network type, rejecting with InvalidParameterValue otherwise. Genuinely invalid enum values are
still rejected at both the RDS Query API and CloudFormation provisioner layers.
The CloudFormation update path now also refuses a changed EndpointNetworkType or
TargetConnectionNetworkType the same way it already refused a changed DBProxyName, EngineFamily,
or VpcSubnetIds: both are createOnlyProperties in the AWS::RDS::DBProxy registry schema, and
ModifyDBProxy has no such parameters, so silently accepting a changed value on UpdateStack would
report UPDATE_COMPLETE while the proxy's actual network type stayed put.
Added a Terraform compatibility scenario (rds-proxy-network-type-tf) with a genuinely
dual-stack VPC and subnets, plus negative cases for an IPv4-only VPC and for a dual-stack VPC
whose subnets lack an IPv6 CIDR block.
|
||
|
|
315dfe69f0 |
fix(rds): support tagging DB snapshots (#3649)
TagResource/UntagResource/ListTagsForResource rejected a snapshot ARN
outright ("not yet implemented by Floci"), and CreateDBSnapshot
silently dropped its Tags parameter even though DbSnapshot already had
a tags field. Both are now wired up: CreateDBSnapshot stores Tags, the
generic tag-resource dispatch resolves a "snapshot" ARN type against
the snapshot store, and DescribeDBSnapshots echoes DBSnapshotArn and
TagList like the other tagged resource types already do.
Snapshots are now region-scoped the same way DB instances and clusters
already are: CreateDBSnapshot/DescribeDBSnapshots/DescribeDBSnapshot-
Attributes/ModifyDBSnapshotAttribute/RestoreDBInstanceFromDBSnapshot
all thread the request's signed region through to snapshot storage and
lookup (via the same dbResourceKey/hasRdsResourceIdentity scoping the
instance/cluster stores use), so DBSnapshotArn reflects the request's
actual region and a snapshot created in one region is not visible to
Describe/Tag calls signed for another.
Verifying this live against a real floci instance via Terraform
surfaced two more gaps blocking any use of aws_db_snapshot at all,
regardless of tagging: DescribeDBSnapshotAttributes (called on every
read of the resource) and ModifyDBSnapshotAttribute were both
completely unimplemented. Added minimal support for both (the
"restore" attribute, i.e. cross-account copy/restore authorization,
modeled as plain in-memory state, no real cross-account sharing).
DeleteDBSnapshot is also unimplemented and was not added here — a
snapshot can be created and tagged but not destroyed via Terraform.
Noted in docs/services/rds.md as a follow-up, along with the other
resource types the original gap report mentioned (Aurora cluster
snapshots, reserved instances) that aren't modeled in Floci at all, so
tagging doesn't apply to them either.
Added a Terraform compatibility scenario (aws_db_snapshot with tags,
verifying create, tag read-back, a clean second plan, and an in-place
tag update) and ran it against a live floci instance before
committing, including a re-run after the region-scoping fix.
|
||
|
|
21d9e7b8f4 |
test(ec2): cover security group rule sources at the Terraform layer (#3308)
Regression coverage for #2266 at the layer where the bug actually bit. When AuthorizeSecurityGroupIngress dropped the source group, the Terraform provider's create-wait could not find the rule it had just created and the apply failed with "couldn't find resource", which no API-level assertion reproduces. The quieter half of the same bug, a rule that comes back without its source, applies cleanly and then shows as drift forever, which only an empty re-plan catches. Both spellings are exercised because they read the source back through different APIs: aws_security_group_rule polls DescribeSecurityGroups, and aws_vpc_security_group_ingress_rule polls DescribeSecurityGroupRules. A CIDR rule sits alongside them so a group carrying both kinds cannot lose the reference, and a CIDR rule cannot sprout a phantom one. The fix itself is already covered by Ec2SecurityGroupRuleSourcesIntegrationTest and by an AWS CLI case in sdk-test-awscli; this adds the Terraform layer, which had none. |
||
|
|
b3465ec94b |
ci(compat): run the Terraform and OpenTofu bats files concurrently (#3282)
* ci(compat): run the Terraform and OpenTofu bats files concurrently compat-terraform is the slowest leg of the compatibility workflow and the job that ends it: its test step is flat at 13m18s to 13m32s across recent runs, while every other leg finishes several minutes earlier. The six bats files ran as a single `bats test/` process, so they executed one after another even though each is an independent root module with its own state and identifiers. Their cost is dominated by the AWS provider's own waiters rather than by floci: Neptune and ElastiCache sleep 30s before the first poll on create and delete, and RDS sleeps 60s. Nothing can shorten those, only overlap them. Each test/*.bats file now runs in its own process, reaped with wait, writing one junit-<file>.xml. bats' own --jobs needs GNU parallel or rush, neither of which is in the image, so the files are forked directly. Output is collected per file and replayed in a fixed order, because six interleaved streams are unreadable. BATS_PARALLEL_FILES=0 restores sequential execution for isolating a failure. Both run.sh wrappers and the justfile recipes delegate to the same runner, so a local run and a CI run execute identical logic. The provider plugin cache is warmed once before forking: every fixture deletes its lock file in setup_file and the AWS provider unpacks to 770 MB, so six concurrent inits would otherwise pull about 4.6 GB. The warm-up is sequential because that cache is safe for concurrent readers but not writers, and a failure there is logged and tolerated rather than fatal. Also adds the .dockerignore both suites were missing. Each directory can hold a local .terraform/ of several hundred megabytes plus stray state, none of which exists in a CI checkout, so image builds were copying roughly 1.4 GB of host state and behaving differently from CI. Measured locally on the same image, all 84 tests passing either way: sequential 1130s, concurrent 260s. * ci(compat): clear stale JUnit reports before running the suites The runner created the results directory but never cleared it, and the per-file reports do not replace everything an earlier run could have left: a renamed or removed bats file keeps its old XML, and so does a run that stops before writing all of them. Every consumer globs the directory, so those linger in the summary. CI never saw this, since it starts from a fresh checkout with an empty test-results. Locally the directory persists in the working tree, and the case is already live: both suites still hold the single junit.xml the previous sequential runner wrote, which the junit-<file>.xml names could never overwrite. A local run mixed months-old results into the current ones, including in the timing numbers this change was measured with. Raised by the review on this PR. * fix(compat): stop the report cleanup reaching other suites' results The cleanup added in the previous commit globbed junit*.xml, which is wrong wherever the results directory is shared. docker/run-docker-tests.sh mounts one test-results directory for all eight suites and runs them in order, so the glob deleted compat-terraform's six reports when compat-opentofu started, and both suites deleted the junit.xml that sdk-test-awscli and compat-cdk had already written. It destroyed results rather than tidying them. The deletion now names the reports this run is about to write, taken from the bats files already enumerated above it, so it cannot reach a filename this suite does not own. That keeps the reason the cleanup exists, a run that stops before rewriting every report leaving the survivors behind, without the reach. One case is deliberately given up: a report whose bats file was renamed or removed is no longer cleared, because nothing in the current run names it. A lingering stale report is cosmetic; deleting another suite's results is not. Raised by the review on this PR. |
||
|
|
67198c7064 |
fix(elasticache): honor the requested Port on CreateReplicationGroup (#3276)
* fix(elasticache): honor the requested Port on CreateReplicationGroup
Port is a modeled optional input on CreateReplicationGroup ("the port number
on which each member of the replication group accepts connections"), but
allocateProxyPort took no argument and always handed out the next free port
from the base of the range. A caller that pinned a port read back a different
one, which Terraform reports as a replacement-forcing change and therefore as
permanent drift.
allocateProxyPort now takes the requested port and honors it when it is free
and inside the proxy range, matching NeptuneService.allocateProxyPort. Floci
multiplexes every group's proxy onto one host, so two groups genuinely cannot
share a port; when the requested one is taken or out of range this logs why
and falls back to the next free port rather than failing the create. In
cluster mode only the first node can take the requested port, because the
group reports its port from that node.
The compatibility fixtures pinned 6379, the bottom of the range and the port
floci would have allocated anyway, so they asserted nothing and passed by
coincidence. They now pin 6395, which fails without this fix.
* fix(elasticache): refuse a requested Port that cannot be honored
Honoring Port left one path that quietly ignored it: a requested port that was
already held by another replication group, or outside the range this emulator
serves, fell back to the next free one. The describe then reported the allocated
port, so a caller who pinned one still read back a different value and still saw
the replacement-forcing drift that honoring Port exists to remove. The narrower
case reproduced the bug the change was written to fix.
The fallback could only ever hit a caller who did ask for a port, since one who
does not care passes no Port at all and never reaches that branch, so it served
nobody. An explicit port is now either honored or refused with
InvalidParameterValue, the sender fault CreateReplicationGroup declares, naming
the port and the reason so the caller can pick another. Unpinned creates still
scan the range exactly as before, and the restore path for persisted groups is
unaffected because it asks for no particular port.
The two tests that pinned the old fallback are inverted rather than dropped, so
the new contract is held just as firmly, and one more proves an unpinned create
still falls back when the base port is taken.
NeptuneService.allocateProxyPort carries the same substitution and RdsService
ignores a requested port entirely; both are left for their own changes.
Raised by the review on this PR.
|
||
|
|
991470e7c4 |
fix(cloudtrail): implement CreateTrail with tagging support and add integration tests (#3206)
Signed-off-by: Matheus André <matheusandr2@gmail.com> |
||
|
|
e7256f5556 |
fix(transfer): allow DeleteServer regardless of server state (#2897)
* fix(transfer): allow DeleteServer regardless of server state AWS's DeleteServer API has no state precondition: its error list has no ConflictException, and terraform-provider-aws's resourceServerDelete calls DeleteServer directly without stopping the server first. The OFFLINE-only guard made every terraform destroy of a running aws_transfer_server fail with a 409 that real AWS never returns. CreateServer's ONLINE default is left as is: it matches real AWS, where a new server transitions STARTING -> ONLINE automatically without a StartServer call, and terraform's waitServerCreated treats OFFLINE as an unexpected state that fails apply immediately. Added an integration test locking in both behaviors. Fixes #2802 * fix(transfer): return Domain from DescribeServer and ListServers Real AWS always reports a server's Domain (default S3). Floci dropped the field on CreateServer and never echoed it, so terraform-provider-aws read back "" into its ForceNew domain attribute (default "S3") and every re-plan of an aws_transfer_server proposed a replacement: + domain = "S3" # forces replacement Store Domain on create, defaulting to S3 like AWS, and include it in DescribeServer and ListServers. Needed for the resource to survive the whole-config re-plan assertion in the terraform compat suite. * test(compat): add aws_transfer_server to the terraform and opentofu suites The resource was pulled from both fixtures while #1834 iterated because DeleteServer 409'd on a running server (#2802). With that fixed, put it back: the server is never stopped, so terraform destroy hits DeleteServer while it is ONLINE, and the existing whole-config re-plan test guards the DescribeServer round trip. * docs(transfer): drop the OFFLINE precondition from DeleteServer |
||
|
|
2c6a92c07d |
feat(ses): implement v1 receipt filters (CreateReceiptFilter, ListReceiptFilters, DeleteReceiptFilter) (#3163)
Adds the three v1 receipt-filter actions as a stored-but-inert IP filter store alongside the receipt-rule-set domain: filters round-trip through the management API but never filter an inbound connection, since Floci accepts none. Validation follows real AWS as probed: the filter name is a single service-level layer (no Smithy pattern, unlike rule and rule-set names) with "Not a valid filterName" for every malformed shape and its own message for an empty name; IpFilter members are Smithy-enforced (not-null paths and the [Allow, Block] policy enum); the Cidr member accepts a single IPv4 or IPv6 address or an in-range CIDR block and rejects everything else with "Invalid CIDR block"; duplicates are AlreadyExists with the original kept; deletes are idempotent with only an absent FilterName rejected; and the 101st filter in a region is rejected with LimitExceeded "Too many filters". List responses are name-sorted for determinism since the probe could not pin the wire ordering. Covered by unit tests, Query-protocol integration tests, an AWS SDK compatibility test, and Terraform/OpenTofu compat coverage for aws_ses_receipt_filter. |
||
|
|
fd665a08cc |
feat(ses): implement v1 receipt rules with locally validated action targets (#3119)
* feat(ses): implement v1 receipt rules with locally validated action targets Adds the five v1 receipt-rule actions (CreateReceiptRule, DescribeReceiptRule, UpdateReceiptRule, DeleteReceiptRule, SetReceiptRulePosition) on top of the stored-but-inert receipt-rule-set domain. Rules route no mail, but ordering semantics follow real AWS as probed: a rule created without After is inserted at the front, SetReceiptRulePosition without After moves a rule to the front, update replaces the whole rule in place, and rule delete is idempotent while rule-set delete cascades. Action targets are validated against the local emulator the way real SES validates them against the account: any TopicArn must be an existing SNS topic, an S3 BucketName an existing bucket, a Lambda FunctionArn an existing function, and a BounceAction Sender a verified identity, using the probed error codes (InvalidSnsTopic, InvalidS3Configuration, InvalidLambdaFunction, InvalidParameterValue). Smithy-layer validation reproduces the probed member paths and combined violation messages; only the members real SES enforces are required (S3 BucketName, SNS TopicArn, and Stop Scope may be absent). Covered by unit tests with mocked resource services, Query-protocol integration tests, an AWS SDK compatibility test, and Terraform/OpenTofu compat coverage for aws_ses_receipt_rule. * fix(ses): match probed AWS semantics for action-list gaps and present-struct required members Probing triggered by the upstream review corrected two earlier conclusions. A gap in the action list (an empty struct serializes to no Query keys) is not compacted by AWS: the gap is padded into an empty action slot and rejected with InvalidParameterValue "Exactly one action type must be specified for each ReceiptAction", with Smithy paths keeping the wire index. member.0 is rejected outright with MalformedInput "0 is not a valid index". The earlier "optional" verdict for S3Action.BucketName, SNSAction.TopicArn, and StopAction.Scope was an artifact of empty structs never reaching the wire: once an action carries any member, the type's required members are enforced as Smithy violations. BounceAction violations are reported in the probed smtpReplyCode, sender, message order, and SNSAction reports a bad Encoding enum before the missing TopicArn. * fix(ses): honor original receipt-action index spellings and require stop actions last Probing the leading-zero report pinned AWS's index semantics exactly: index tokens are grouped by numeric value, ordered by length then lexicographically, and the i-th token must parse to i, or the padded empty slot is rejected with the exactly-one-action-type error. member.01 alone is therefore a valid slot 1 whose action must be parsed under its original spelling instead of a rebuilt canonical one, while mixed spellings such as member.01 plus member.2 are rejected because the one-digit token sorts first. The same probes surfaced an unrelated service-level rule now reproduced too: a stop action anywhere but the last position is rejected with "Stop action, if any, must be placed at the end of the actions list". * chore(ses): log best-effort compat-test cleanup failures with resource context The three cleanup catches in the receipt-rule compatibility suite swallowed failures silently. They now report the failed step and resource on stderr, the form the other suites in this module already use, so leaked test resources stay diagnosable. * chore(lambda): log functionExists resolution failures at debug level The catch converts a resolution failure into the predicate's negative answer; the debug line keeps a surprising false diagnosable (which reference was rejected, and why) without turning ordinary existence misses on a query path into log noise. * fix(ses): restrict receipt-action index tokens to ASCII digits Character.isDigit also accepts non-ASCII Unicode digits, so a key such as Rule.Actions.member.<fullwidth 1> parsed as a real index. No AWS Query index grammar recognizes those spellings; the key is now skipped like any other unmodeled parameter, pinned by an integration test. --------- Co-authored-by: Priamo <pgermosen@gmail.com> |
||
|
|
724be0a6a7 |
fix(s3): return composite multipart checksums and match S3 on UploadPart, GetObjectAttributes and CopyObject responses (#3093)
* fix(s3): return composite checksums for multipart uploads CompleteMultipartUpload stored the checksum of the whole object but labelled it COMPOSITE, so clients that recompute the composite value from the part checksums, as the AWS documentation describes, never matched it. Follow the AWS checksum type rules, verified against real S3: - SHA1/SHA256 are always COMPOSITE, CRC32/CRC32C default to COMPOSITE and CRC64NVME is always FULL_OBJECT. x-amz-checksum-type on CreateMultipartUpload selects FULL_OBJECT for CRC32/CRC32C; incompatible combinations fail with InvalidRequest, and the response echoes x-amz-checksum-algorithm/-type. - The composite value is the algorithm applied to the concatenated binary part checksums, Base64 encoded, with a "-<part count>" suffix. It is returned by CompleteMultipartUpload, HeadObject and GetObject (with x-amz-checksum-type), while GetObjectAttributes omits the suffix, as AWS does. - A checksum sent on CompleteMultipartUpload is validated against the stored type: a mismatching value is a BadDigest (the composite is accepted with or without its suffix), a checksum type different from the one the upload was created with is an InvalidRequest, per-part checksums in the request body that do not match the uploaded parts are an InvalidPart, and a COMPOSITE upload completed without the checksum of every part is an InvalidRequest (FULL_OBJECT uploads need none, as on S3). A non-numeric PartNumber is a MalformedXML instead of a 500. - UploadPart echoes the part checksum (x-amz-checksum-<algorithm>) when the upload declared an algorithm, as S3 does; without one no header is returned. - CopyObject writes a single object without a part manifest; a composite source gets a full-object checksum recomputed with its algorithm, and CopyObjectResult carries the checksum elements, matching AWS. - GetObjectAttributes lists part-level checksums only for COMPOSITE objects: a FULL_OBJECT multipart object reports its PartsCount alone and a single-part object has no ObjectParts element. The algorithm and type rules live in two new enums, ChecksumAlgorithm and ChecksumType, parsed once from the request headers; S3Checksum builds the full-object, composite and GetObjectAttributes views of a checksum. The boto3 compatibility suite gains multipart upload_file cases for SHA256 and for the SDK's default CRC32, asserting the composite value and the part list. The S3 docs drop the stale note that checksum responses focus on SHA-1 and SHA-256 (CRC32, CRC32C and CRC64NVME have been supported since #877) and list the AWS algorithms Floci rejects. * fix(s3): return the GetObjectAttributes ETag without quotes S3 returns the ETag element of GetObjectAttributes without the surrounding quotes that HeadObject, ListParts and CompleteMultipartUpload keep. Verified against real S3 with the same object: head_object gives "af3c...-3" while get_object_attributes gives af3c...-3, and the AWS CLI reference shows the same in its get-object-attributes example. Floci echoed the quoted value, so a client comparing both saw different strings on Floci and equal ones nowhere. * fix(s3): give a copied object its own ETag CopyObject kept the ETag of the source, so the copy of a multipart object carried the "<md5-of-md5s>-N" value of its parts. S3 writes a copy as a single object and returns the MD5 of the whole content as its ETag, in CopyObjectResult and HeadObject alike (verified against real S3: source "af3c...-3", copy "a5f04f..."). The copy now keeps the ETag storeObject computes. * fix(s3): send CopyObjectResult as application/xml The CopyObject response carried Content-Type: text/plain;charset=UTF-8 for an XML body. S3 labels it application/xml like every other XML response. * test(s3): cover multipart checksums in every SDK compatibility suite Each SDK implements flexible checksums differently, so the multipart flows are exercised per client rather than once: the Go transfer manager (what terraform-provider-aws uses), @aws-sdk/lib-storage for Node, the Java SDK v2 both low-level and through S3TransferManager on the multipart-enabled async client, the AWS CLI (s3api, aws s3 cp --checksum-algorithm and a plain aws s3 cp that goes multipart on its own) and boto3. Every case asserts the composite or full-object value computed in the test itself, the UploadPart echo, the suffix-less GetObjectAttributes checksum and unquoted ETag, the rejected Complete without part checksums, and the copy of a multipart object as a single full object with its own ETag. The default algorithm cases accept whatever the SDK version declares (CRC32 composite or full object, or none) and check the stored value against it. * test(terraform): upload a large aws_s3_object with Terraform and OpenTofu The IaC suites created buckets but never an object, so the code path that surfaced the composite checksum bug, an aws_s3_object above the provider's part size uploaded through the SDK transfer manager, was not covered. Both suites now upload a 12 MiB file generated by the test setup with checksum_algorithm SHA256 and check that HeadObject reports a COMPOSITE checksum equal to the composite computed locally over the part sizes GetObjectAttributes lists, that the state attribute holds the same value, and that re-planning the object shows no drift. compat-opentofu moves to the same aws-cli image as compat-terraform (2.34.32): 2.15 predates the S3 checksum type and cannot show ChecksumType in its output. * fix(s3): reject x-amz-checksum-type without a checksum algorithm CreateMultipartUpload only parsed x-amz-checksum-type when an algorithm was declared, so a type sent on its own, valid or not, was silently ignored. S3 validates the header regardless: an unknown value is InvalidRequest "Value for x-amz-checksum-type header is invalid." and a valid one without an algorithm is InvalidRequest "The x-amz-checksum-type header can only be used with the x-amz-checksum-algorithm header." (both verified against real S3). * test(s3): log cleanup failures in the multipart checksum compat tests The Java, Node and Go cases swallowed errors while deleting their objects and bucket. They now report what could not be deleted and why, so a leftover is diagnosable instead of silent. --------- Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com> |
||
|
|
a7be2dd299 |
feat(neptune): support the Terraform aws_neptune_cluster read-back contract (#3017)
* feat(neptune): support the Terraform aws_neptune_cluster read-back contract The Terraform AWS provider's aws_neptune_cluster resource reads back every DBCluster field after create and update, and treats a mismatch on a ForceNew attribute as a replacement. Against Floci the resource could not converge: StorageEncrypted was hardcoded to true against the provider's default of false, AvailabilityZones was emitted as a singular element that SDK parsers drop, BackupRetentionPeriod and the other settings were never stored, and tag calls on a Neptune ARN never reached the Neptune store. CreateDBCluster and ModifyDBCluster now store the settings a request carries (NeptuneClusterSettings, modelled on DocDbClusterSettings) and DescribeDBClusters reads them back with the AWS defaults otherwise: AvailabilityZones, BackupRetentionPeriod, PreferredBackupWindow, PreferredMaintenanceWindow, DBSubnetGroup, DBClusterParameterGroup, VpcSecurityGroups, StorageEncrypted, KmsKeyId, StorageType, DeletionProtection, CopyTagsToSnapshot, EnabledCloudwatchLogsExports, ReplicationSourceIdentifier, ServerlessV2ScalingConfiguration, AssociatedRoles and ClusterCreateTime. StorageEncrypted defaults to false as on AWS. Also: - A requested Port is honoured when it is free inside the proxy range, so Terraform's default port of 8182 matches the first cluster. - DeleteDBCluster refuses a cluster with DeletionProtection enabled with InvalidParameterCombination, as on AWS. - DBClusterMembers uses the DBClusterMember element the Neptune API model declares; the previous member element was dropped by SDK parsers. - New actions: AddRoleToDBCluster, RemoveRoleFromDBCluster, DescribeGlobalClusters (empty list), ListTagsForResource, AddTagsToResource and RemoveTagsFromResource. Tags are accepted on CreateDBCluster and CreateDBInstance, and the rds credential scope routes a Neptune ARN ResourceName to the Neptune handler. Verified against hashicorp/aws 6.62.0 with terraform apply, a clean re-plan, an update covering retention, protection, log exports, security groups, iam_roles and tags, a destroy blocked by deletion protection, and a destroy after disabling it. * test(compat): cover aws_neptune_cluster in the Terraform and Java SDK suites Adds a dedicated Terraform fixture and bats test that applies an aws_neptune_cluster, checks the read-back through terraform output and the AWS CLI, checks tags through ListTagsForResource, and asserts a clean re-plan. Extends the Java SDK NeptuneTest with tags, IAM roles, modify settings, deletion protection and cluster members, so a real SDK parser covers the new DBCluster fields. * fix(neptune): infer the rds service for the DBCluster role actions Unsigned Query requests resolve their service from the action name, and AddRoleToDBCluster and RemoveRoleFromDBCluster were missing from the RDS action set, so they fell through to the SQS default instead of reaching the Neptune handler. * feat(neptune): read back the settings Terraform's aws_neptune_cluster_instance manages DescribeDBInstances omitted AutoMinorVersionUpgrade, PromotionTier, PubliclyAccessible, the parameter and subnet groups and the windows, ModifyDBInstance ignored them, StorageEncrypted was hardcoded to true, and every cluster member was reported as the writer, so the provider issued a ModifyDBInstance on every apply. NeptuneInstanceSettings, modelled on NeptuneClusterSettings, stores what a request carries and DescribeDBInstances reads it back with the AWS defaults otherwise; StorageEncrypted, KmsKeyId and StorageType are the cluster's. The first member of a cluster is its writer and deleting it promotes the next. Covered by unit, integration and Java SDK tests and a Terraform compat fixture with a writer and a reader instance. --------- Co-authored-by: kurtmc <2661907+kurtmc@users.noreply.github.com> |
||
|
|
65e1d506cc |
ci(compat): fail the build when compat-opentofu drifts from compat-terraform (#2898)
Adds a CI job comparing the resource address lists in the two configs' main.tf files, failing on any unlisted one-sided resource. The 11 resources already only in compat-terraform (Application Auto Scaling, RDS, the CloudWatch alarm, the IAM managed-policy-attach path, IAM tag coverage, and the GuardDuty org feature) are recorded as pre-existing gaps in a new tf-only allowlist rather than ported, so the check also flags an allowlist entry once it stops being one-sided. Allowlists are directional (separate tf-only / otf-only files) so a resource that flips sides -- dropped from one config and re-added to the other under the same address -- is still reported as unreviewed drift instead of silently matching a stale entry from the old side. Closes #2263 |
||
|
|
8765cde6dd |
test(terraform): expand Floci IaC compatibility coverage (#1834)
* test(terraform): expand Floci IaC compatibility coverage * fix(terraform): use current S3 backend path style option * fix(terraform): route ElastiCache provider calls to Floci * fix(compat): resolve Firehose name collision, drop resources with live Floci gaps - aws_kinesis_firehose_delivery_stream.compat collided with main's .events stream (both named floci-compat-firehose); renamed to floci-compat-firehose-basic. - Removed aws_codebuild_project, aws_cloudtrail, and aws_opensearch_domain from both suites: running the suite end-to-end surfaced real Floci gaps behind them (BatchGetProjects ARN lookup, CloudTrail ListTags, OpenSearch CognitoOptions nil deref crashing the provider) that only show once Terraform gets past apply into the post-create refresh. Tracked as #2799, #2800, #2801. - Updated test counts in README to match (70/44/2,582). * fix(compat): force_destroy the compat bucket, drop resources with live teardown gaps - aws_s3_bucket.app now sets force_destroy = true: the CUR report now actually emits into this bucket (format=Parquet finally lets the report definition get created), so terraform destroy needs to be able to clear a non-empty bucket. - Removed aws_transfer_server: Floci's DeleteServer wrongly requires OFFLINE state, which isn't real AWS behavior (confirmed against the API reference and terraform-provider-aws's own delete logic, which never calls StopServer first). Tracked as #2802. - Removed aws_batch_compute_environment: UpdateComputeEnvironment (called by terraform destroy to disable it first) isn't implemented at all, so the request falls through to an HTML error page instead of a modeled error. Tracked as #2803. - Updated test counts in README to match (68/42/2,578). * fix(compat): drop aws_api_gateway_rest_api pending Floci apiStatus fix CI (native / compat-terraform) showed terraform apply deterministically timing out on aws_api_gateway_rest_api: terraform-provider-aws waits for the REST API's apiStatus field to reach AVAILABLE, and Floci never sets it (confirmed apiStatus is a real, current field in the apigateway wire model). Removed from both suites; tracked as #2804. Updated test counts in README to match (67/41/2,576). * fix(compat): drop redundant ECS containerInsights setting causing drift CreateCluster silently drops the settings field on Floci (confirmed: handleCreateCluster never parses req.path("settings"), unlike the update handlers), so a subsequent plan always proposes re-adding it - permanent drift on the suite's "re-planning reports no changes" check. containerInsights=disabled is AWS's actual default, so the block was functionally redundant; dropped it rather than block on a Java fix. Tracked as #2806. --------- Co-authored-by: Priamo <pgermosen@gmail.com> |
||
|
|
97ff0bc3e9 |
feat(elasticache): support cluster-mode replication groups (#2633)
* feat(elasticache): support cluster-mode replication groups CreateReplicationGroup now provisions a real sharded Valkey cluster when the request asks for one (NumNodeGroups > 1, a cluster.on parameter group, or ClusterMode=enabled): one cluster-enabled container per node, formed via config epochs, MEET, slot assignment and replica attachment, each fronted by its own auth-proxy port announced to clients via cluster-announce-client-ipv4/cluster-announce-port so CLUSTER SLOTS and MOVED redirects point at reachable addresses. DescribeReplicationGroups reports the topology honestly (ClusterEnabled, NodeGroups with Slots, MemberClusters, Engine, ARN, AutomaticFailover), and replication-group members answer DescribeCacheClusters, which is where terraform-provider-aws reads node type, engine version and port from. Adds a terraform compatibility test that applies an aws_elasticache_replication_group with num_node_groups and replicas_per_node_group, asserts the data plane is a formed cluster running in cluster mode (INFO cluster / CLUSTER INFO over RESP through the proxy), and that a re-plan straight after apply is clean. * fix(elasticache): address cluster-mode review feedback and compat CI failure - bump compat-terraform aws-cli image to 2.34.32 so botocore models include ReplicationGroup.Engine (old pin silently dropped the field) - restore cluster-mode runtime state (ports, containers, proxies, cluster formation) after restart; mark groups create-failed on error - announce configured hostname to Valkey nodes so MOVED redirects and CLUSTER SLOTS return client-reachable endpoints - log swallowed socket-close failures in cluster formation * fix(elasticache): report restore-failed members and modeled node-group quota fault Review follow-up for cluster-mode support: - Member cache clusters mirror their group's status instead of a hardcoded "available", so a group marked create-failed by a failed restore no longer contradicts its own members in DescribeCacheClusters. CacheClusterStatus has no create-failed value, so failed members report the documented restore-failed. - NumNodeGroups above the 500 ceiling surfaces the modeled NodeGroupsPerReplicationGroupQuotaExceeded fault instead of a generic InvalidParameterValue. - Javadoc names ClusterMode=compatible handling and the cluster-mode-only restore scope as deliberate. * fix(elasticache): announce a client-resolvable hostname for cluster mode Cluster-mode nodes announced FLOCI_HOSTNAME verbatim, so the shipped Docker Compose deployment baked the Compose-only name 'floci' into MOVED/ASK redirects and topology responses, breaking cluster-aware clients connecting from outside the Compose network. Add FLOCI_SERVICES_ELASTICACHE_CLUSTER_ANNOUNCE_HOSTNAME (default: FLOCI_HOSTNAME) used for the announced name and the reported ConfigurationEndpoint, and set it to localhost.floci.io in docker-compose.yml — public DNS resolves it to 127.0.0.1 on the host while the network alias and Floci's embedded DNS resolve it to the Floci container from inside Docker. * fix(elasticache): restore cluster-mode groups without blocking startup Restoring persisted cluster-mode groups ran serially in the synchronous startup path, so a slow or unavailable Docker daemon could hold up emulator readiness by a container-readiness plus cluster-formation timeout per group, timing out readiness-dependent clients such as Testcontainers. restorePersistedRuntime now reserves each node's proxy port and marks groups creating synchronously - so no request can claim a persisted port or see a stale available status - then brings containers, cluster formation and proxies back in the background, flipping each group to available or create-failed as its restore finishes. --------- Co-authored-by: kurtmc <2661907+kurtmc@users.noreply.github.com> |
||
|
|
5ed3a8cad9 |
fix(rds,firehose,cognito): match AWS's real defaults so a second terraform plan reports no changes (#2420)
* fix(rds,firehose,cognito): match AWS's real defaults so a second terraform plan reports no changes
Three unrelated fields across three services all had the same shape of
bug: a value AWS defaults or fills in was never populated, so a create
(or a later describe) returned something a real AWS response never
would - applying cleanly and then drifting on every subsequent plan.
- RDS: AutoMinorVersionUpgrade was never read from CreateDBInstance or
echoed back at all. AWS defaults it to true when omitted (confirmed
against the CreateDBInstance API reference, whose example response
echoes it explicitly); floci reported false/absent. Threaded the
request parameter through to the model and the response XML,
defaulting to true like AWS does.
- Firehose: S3BackupMode was missing from the ExtendedS3Destination
model entirely, so describeDeliveryStream's existing applyDefaults()
(which already backfills CompressionFormat/EncryptionConfiguration
for exactly this reason) never touched it. Added the field and its
"Disabled" default there.
- Cognito: DeviceConfiguration/UserPoolAddOns/EmailConfiguration all
returned an empty JSON object when unconfigured. Reproduced against
a live floci with the actual compat Terraform fixture and confirmed
via re-plan: an empty object (rather than a real default or a JSON
null) got Terraform's AWS provider to capture one shape into state
at apply and read back a different one on refresh.
- DeviceConfiguration/UserPoolAddOns: AWS's own docs state "a null
value indicates you have deactivated device remembering" - matched
that by emitting JSON null instead of {} when unconfigured (an
earlier version of this fix filled UserPoolAddOns with
AdvancedSecurityMode: OFF based on a doc example that turned out to
be echoing an explicitly-set request value, not demonstrating a
real default - caught by re-running the actual reproduction rather
than trusting the read).
- EmailConfiguration: defaults EmailSendingAccount to COGNITO_DEFAULT,
matching its documented built-in-email-by-default behavior.
Verified end to end against the real compat-terraform fixture (not
just unit tests): a full `terraform apply` followed by
`terraform plan -detailed-exitcode` now exits 0 with "No changes"
across every resource in the fixture, not just these three. Widened
the "re-planning ... reports no changes" bats test from the
Application-Auto-Scaling-only subset it was scoped to (specifically to
dodge this bug) to the full configuration, per the issue's own
suggestion.
Closes #2200.
* fix(rds,firehose): propagate AutoMinorVersionUpgrade/S3BackupMode through update, not just create
Two review findings on the same class of bug this PR already fixes for
create/describe, but for the update path instead:
- ModifyDBInstance silently ignored AutoMinorVersionUpgrade - an
explicit modify request was accepted (200) but never applied, so a
subsequent describe kept reporting the old value. Threaded it
through as a nullable Boolean, matching the existing
EnableIAMDatabaseAuthentication pattern (null = not specified, so
ModifyDBInstance's other unrelated fields aren't force-reset).
- FirehoseService#mergeDestination copied every ExtendedS3DestinationUpdate
field except S3BackupMode, so an UpdateDestination call that changed
it applied cleanly but the change never took.
A third finding (S3BackupMode also appears in the standard, non-extended
S3DestinationDescription shape) is real but pre-existing: Destination
already serializes the same S3Destination object under both
S3DestinationDescription and ExtendedS3DestinationDescription keys, so
CustomTimeZone and FileExtension - both extended-only fields per AWS's
S3DestinationDescription reference - already leak into the standard
shape today. Not fixing that here; it's a separate, larger change
affecting fields this PR didn't touch.
* fix(firehose): stop leaking extended-only fields into the standard S3 destination shape
S3DestinationDescription and ExtendedS3DestinationDescription shared
the same S3Destination object, so FileExtension/CustomTimeZone/
S3BackupMode - all extended-only per AWS's S3DestinationDescription
reference - leaked into the plain shape on every describe.
Added S3Destination#standardView(), a copy holding only the fields
AWS's plain shape actually has, and serve it from
getS3DestinationDescription(). ExtendedS3DestinationDescription keeps
serializing the live object with every field, as before.
The first attempt at this filtered the wrong call site: s3Destination(),
the internal accessor every FirehoseService business method uses
(object-key file extension/timezone logic, applyDefaults(), merges),
went through the same getter and got the same filtered copy - silently
dropping those three fields from all of it, including applyDefaults()
mutating a throwaway copy instead of the real stream. Repointed it to
getExtendedS3DestinationDescription() instead, which was never touched.
* fix(cognito): omit unset DeviceConfiguration/UserPoolAddOns instead of emitting JSON null
hectorvent's review: AWS's JSON protocol serializes only members with
a value provided - an unconfigured pool omits the key entirely, it
doesn't write a wire-level null. The "a null value indicates..." line
in AWS's own docs describes what a typed SDK getter returns for an
absent member, not the JSON literal.
Verified independently rather than taking either side on faith: the
Smithy awsJson1_1 protocol spec describes serializing "each member
value provided" as a JSON property (nothing for members without one),
and moto's DescribeUserPool never writes either key when unset - its
to_json() only ever adds keys present in extended_config, no
None-producing default. Switched both fields from putNull to omitting
the node.set(...) call entirely, matching how every other genuinely-
optional field in this same method is already handled.
|
||
|
|
6779aa8270 | feat(guardduty): add GuardDuty detector and organization configuration emulation (#2346) | ||
|
|
984886f697 |
feat(kms): implement UpdateAlias (#2324)
* feat(kms): implement UpdateAlias Repoints an existing alias at a different KMS key, following the existing createAlias/deleteAlias/resolveKey patterns. Required by the Terraform AWS provider, which treats a target_key_id change on aws_kms_alias as an in-place update. * fix(kms): reject invalid replacement keys in UpdateAlias UpdateAlias accepted any existing key as a replacement target, including keys pending deletion or with a different key usage/spec than the alias's current target. Real AWS KMS rejects both: the replacement key must be in a compatible state and match the current target's key usage and key spec. * fix(kms): compare key type instead of exact key spec in UpdateAlias The exact KeySpec comparison rejected valid updates between same-type keys with different specs (e.g. RSA_2048 to RSA_3072), which AWS KMS accepts as long as both keys share the same key type and usage. * test(kms): add Terraform compatibility test for UpdateAlias Verifies the exact scenario from #2291: the Terraform AWS provider treats target_key_id on aws_kms_alias as an in-place update, so re-applying with a different target must call UpdateAlias and update the alias without a destroy/recreate. Self-contained config, mirroring the eni-destroy-tf pattern, since it needs a second apply with a different var rather than the shared single-apply main.tf. * fix(kms): compare key family instead of KeyType in UpdateAlias Comparing the fine-grained KeyType enum rejected valid cross-family asymmetric updates (e.g. RSA_2048 to ECC_NIST_P256) that AWS KMS accepts. AWS only requires the current and new key to be "the same type (both symmetric or both asymmetric or both HMAC)" - a coarser three-way split - so compare on that instead. |
||
|
|
b71bfc46b6 |
fix(iam,lambda): return resource tags in Get and Create responses (#2262)
* fix(iam,lambda): return resource tags in Get and Create responses
IAM stored role, policy and user tags and served them through
ListRoleTags/ListPolicyTags/ListUserTags, but never serialized them into
the Create/Get responses. Lambda did the same with GetFunction. The AWS
SDKs and the Terraform provider read tags off those responses rather than
by calling List*Tags, so every tagged role, policy, user and function read
back untagged: apply succeeds and then plan never converges.
The inclusion is asymmetric, and getting that wrong deviates from AWS in
the opposite direction. IAM's resource-listing operations deliberately
return a subset of attributes:
ListRoles "does not return the following attributes, even though they
are an attribute of the returned object: PermissionsBoundary,
RoleLastUsed, Tags"
ListUsers same, for PermissionsBoundary and Tags
ListPolicies "this operation does not return tags"
roleXml, userXml and policyXml therefore take a detailed flag, following
the pattern #2155 established for the policy Description. Description on a
role stays unconditional: it is absent from the ListRoles exclusion list.
For policies one flag governs both Description and Tags, since ListPolicies
excludes them on identical grounds.
Detail call sites are CreateRole, GetRole, CreateServiceLinkedRole,
CreateUser, GetUser, CreatePolicy and GetPolicy. Listing call sites are
ListRoles, ListUsers, ListPolicies and GetGroup, plus the roles embedded in
an instance profile — GetInstanceProfile's own example response shows those
as a subset.
tagsElement emits nothing rather than an empty <Tags/> for an untagged
resource, which would otherwise read back as a tag set the caller never
configured.
Lambda needs no such gate: ListFunctions returns FunctionConfiguration,
which has no Tags field at all.
Closes #2199
* test(iam,lambda): cover the tag round trip and the listing-subset rule
Adds a GetFunction case to the Lambda tag test, ordered after the untag so
it also pins that a removed tag is reflected rather than served stale.
Adds a tagged role and a tagged policy to the Terraform compatibility
config, with cases for the positive round trip, the ListRoles/ListPolicies
subset negatives, and a clean second plan. The re-plan assertion is the one
that catches this drift class: tags that do not survive the round trip
apply cleanly and only show up later as perpetual drift.
|
||
|
|
527615bdf0 |
fix(iam): seed the full AWS managed policy catalog (#2194)
* fix(iam): seed the full AWS managed policy catalog AttachRolePolicy and GetPolicy resolved arn:aws:iam::aws:policy/* against a hand-maintained list of 59 entries, so any policy outside it returned NoSuchEntity even though AWS publishes it. Real Terraform and CloudFormation configurations failed for a reason unrelated to the user's setup — attaching AmazonEC2ReadOnlyAccess or service-role/AmazonElasticMapReduceRole was enough to break a stack — and the list could only be extended one policy per PR. The catalog now carries the full published list (1566 entries), loaded from iam/managed-policies.yaml following the existing ec2/image-catalog.yaml pattern. AwsManagedPolicies keeps its POLICIES and ManagedPolicyDef surface, so callers and tests are unaffected. Unknown ARNs still return NoSuchEntity/404. That matters as much as the additions: resolving every well-formed ARN would accept typos that real AWS rejects and would stop CloudFormation rolling a stack back on a bad attachment. Seeding the real catalog is what makes the check faithful in both directions rather than trading one wrong answer for another. The catalog is a union with the previously seeded entries, so a policy AWS has since retired but which Floci already resolved — AWSLambdaFullAccess — keeps working. Curated descriptions are preserved. seedAwsManagedPolicies no longer mirrors the catalog into the account store. That copy was never read back, since listPolicies filters AWS-managed ARNs out of the local scan and serves them from the catalog, and writing 1566 entries on every start cost ~1.4 MB of persisted state and ~3.7s of persistent-mode startup. Policy names and paths derive from the public AWS managed policy list via https://github.com/iann0036/iam-dataset (MIT); only names and paths are used. Regenerate against a real account with `aws iam list-policies --scope AWS`. * fix(iam): register the managed-policy catalog for native image builds AwsManagedPolicies reads iam/managed-policies.yaml through ClassLoader#getResourceAsStream, which Quarkus's static resource analysis cannot see. Without an explicit registration the file is absent from the native image, the stream comes back null and IAM aborts startup — taking the whole application with it. Registered in both places the EC2 image catalog already uses: quarkus.native.resources.includes in application.yml, and the resources pattern in META-INF/native-image/resource-config.json. Verified against the native binary rather than the build alone, since a successful build does not prove the resource is embedded: the native image starts, ListPolicies(Scope=AWS) reports all 1566 entries, previously missing policies attach, and a misspelled ARN still returns NoSuchEntity. Reported by Greptile on #2194. |
||
|
|
ff8d6efdf3 |
feat(ses): implement v1 receipt rule set actions (stored-but-inert) (#2128)
* feat(ses): implement v1 receipt rule set actions (stored-but-inert)
Add the SES v1 receipt-rule-set management actions: CreateReceiptRuleSet,
DescribeReceiptRuleSet, ListReceiptRuleSets, DeleteReceiptRuleSet,
SetActiveReceiptRuleSet, and DescribeActiveReceiptRuleSet. Floci has no inbound-mail
endpoint, so rule sets are stored inertly — a set never holds any receipt rules and
routes no mail — but the management API round-trips so tools like Terraform can declare
a rule set during bootstrap without hitting UnsupportedOperation.
Behavior matches AWS (verified): RuleSetDoesNotExist for a missing set, AlreadyExists
for a duplicate name, idempotent DeleteReceiptRuleSet, and an empty
DescribeActiveReceiptRuleSet when no rule set is active. Individual receipt rules and
receipt filters are out of scope.
* fix(ses): reject deleting the active receipt rule set and read active state under lock
DeleteReceiptRuleSet removed the active rule set unconditionally; AWS rejects it with
CannotDelete/400 (verified), so reject it and preserve the set. DescribeActiveReceiptRuleSet
read without the lock, so a concurrent set-active replacement (clear-then-set) could expose
its intermediate no-active state; read under receiptRuleSetLock so the reader sees the old or
new active set, never the gap.
* fix(ses): validate the receipt rule set name against AWS's constraints
RuleSetName was only checked for non-blank, so Floci accepted names AWS rejects. Validate
it as AWS does (verified): a character outside ^[a-zA-Z0-9_.-]+$ is a ValidationError, and a
name over 64 characters or that does not start and end with an alphanumeric is an
InvalidParameterValue ("Not a valid ruleSetName"). Applied on create/describe/delete and on
set-active when a name is given.
* chore(ses): tidy receipt rule set import order and record the RuleSetName probe provenance
Address review nits: move the ReceiptRuleSet import into alphabetical position in
SesQueryHandler, and expand the RuleSetName validation comment to record that the
constraints come from probing live SES (the botocore model has no pattern), so the
next reader can re-verify rather than treat them as settled.
|
||
|
|
1795e131a2 |
feat(applicationautoscaling): add Application Auto Scaling control plane (#2159)
* feat(applicationautoscaling): add Application Auto Scaling control plane Adds a services/applicationautoscaling package emulating the Application Auto Scaling API (JSON 1.1, AnyScaleFrontendService. target prefix, application-autoscaling signing name). This is a distinct service from the existing EC2 Auto Scaling package, which speaks Query under the autoscaling signing name. Implements the nine actions Terraform exercises: RegisterScalableTarget, DescribeScalableTargets, DeregisterScalableTarget, PutScalingPolicy, DescribeScalingPolicies, DeleteScalingPolicy, and the ListTagsForResource / TagResource / UntagResource trio. Notable behaviours: - Identity is the (ServiceNamespace, ResourceId, ScalableDimension) triple; RegisterScalableTarget upserts on it and leaves unsupplied parameters unchanged, matching AWS. - ScalableTargetARN uses the application-autoscaling service name while PolicyARN uses plain autoscaling and embeds the resource path and policy name — the two ARN families genuinely differ. - Tagging resolves by ScalableTargetARN because the Terraform provider's transparent-tagging interceptor calls ListTagsForResource on every read, keyed on the ARN it reads from DescribeScalableTargets. - Target-tracking policies create the real pair of CloudWatch alarms AWS creates on the caller's behalf; deregistering a scalable target deletes its policies and their alarms. - Optional configuration fields are only echoed back when supplied, so Terraform never sees a value it did not configure. Scaling policies are stored and described but inert: nothing evaluates them and no capacity is adjusted, mirroring EC2 Auto Scaling's existing PutScalingPolicy. This is documented in docs/services/applicationautoscaling.md. Closes #2157 * refactor(applicationautoscaling): stop exposing the scalable target's tag map getTags() handed out the live internal map, and the service mutated it in place at three call sites. listTagsForResource also returned that same live reference out to the handler layer, so a caller could alter stored state without going through the service. getTags() now returns an unmodifiable view, with putTags/removeTags for the mutations the service actually needs, and a test pins the read-only contract. Reported by github-code-quality on #2159. |
||
|
|
b3c54c1854 |
feat(firehose): return ExtendedS3DestinationDescription and support UpdateDestination (#1710)
* feat(firehose): return ExtendedS3DestinationDescription and support UpdateDestination The Terraform/Pulumi provider creates delivery streams with ExtendedS3DestinationConfiguration and reads ExtendedS3DestinationDescription back after create; Floci parsed the config lossily and only ever emitted S3DestinationDescription, breaking the provider read. Store the full config (RoleARN, ErrorOutputPrefix, CompressionFormat, EncryptionConfiguration), emit it under both wire keys like real AWS, add the required output members (VersionId, DeliveryStreamType, HasMoreDestinations, DestinationId), and implement UpdateDestination with version checking. Refs #1043 * fix(firehose): reject empty destination updates and guard version parse * fix(firehose): reject partial BufferingHints instead of absorbing defaults AWS requires SizeInMBs and IntervalInSeconds to be specified together (firehose service-2.json: "if you specify a value for it, you must also specify a value for IntervalInSeconds, and vice versa"). The primitive fields with initializers made a partial payload indistinguishable from a full one, silently persisting a default over an existing value. Members are now null-honest boxed Integers, create and update reject one-sided hints with the declared InvalidArgumentException before any mutation, and defaults apply only when the whole object is absent. |
||
|
|
6c5f533f34 |
fix(cognito): do not return optional blocks in CreateUserPoolClient when they are not set (#1615)
* fix(cognito): do not return optional blocks in CreateUserPoolClient when they are not set * fix(cognito): fix test order in file * fix(cognito): improve bats assertions |
||
|
|
55a90e8299 |
fix(ec2) Fix/1031 ec2 describe network interfaces (#1035)
* feat(ec2): add partial DescribeNetworkInterfaces (phases 1-3) Wire DescribeNetworkInterfaces into the EC2 query handler with ENI data derived from running instances. Covers: - Empty response skeleton - Basic ENI mapping (networkInterfaceId, subnetId, vpcId, groupSet, attachment) - Full field coverage (privateIpAddressesSet, EIP association, tagSet, availabilityZone, interfaceType, attachTime, deleteOnTermination) Remaining: filter support, pagination, error handling, Terraform compat validation (phases 4-6 for #1031). * feat(ec2): add filter support for DescribeNetworkInterfaces (phase 4) Support these filter keys: network-interface-id, subnet-id, vpc-id, group-id, status, private-ip-address, description, owner-id, mac-address, private-dns-name, tag:<key>, tag-key. Filters use AND semantics. No-match filters return HTTP 200 with empty networkInterfaceSet. * feat(ec2): add pagination and error handling for DescribeNetworkInterfaces (phases 5-6) - Add NetworkInterfaceListResult record for paginated responses - Implement offset-based MaxResults/NextToken pagination - Add Base64 token encode/decode for pagination cursor - Validate MaxResults range (5-1000) and MaxResults+NetworkInterfaceId conflict - Conditionally emit nextToken in XML response (only when truncated) - Add InvalidNetworkInterfaceID.NotFound for non-existent IDs - Add InvalidNetworkInterfaceID.Malformed for IDs not starting with 'eni-' - Track found IDs via HashSet for accurate NotFound detection * test(ec2): add DescribeNetworkInterfaces pagination, error, and multipage tests - 5 pagination validation tests (MaxResults range, param conflict, invalid token) - 1 pagination success test (MaxResults > available ENIs, no nextToken emitted) - 2 error handling tests (InvalidNetworkInterfaceID.NotFound and .Malformed) - 1 self-contained multipage pagination test (launches 5 extra instances, verifies MaxResults=5 truncation, NextToken continuation, final page cleanup) - All 87 Ec2IntegrationTest tests pass * test(ec2): add SDK and Terraform compat tests for DescribeNetworkInterfaces - Add Ec2NetworkInterfacePaginationTest with 4 scenarios: all 6 ENIs without pagination, MaxResults=5 truncation, NextToken continuation (no overlap between pages), and token re-use stability - Add eni_destroy.bats Terraform compat test verifying destroy succeeds on VPC+subnet+SG now that DescribeNetworkInterfaces is implemented - Add minimal Terraform config (VPC 10.0.0.0/16, subnet, SG) for ENI test * fix(ec2): align DescribeNetworkInterfaces MaxResults errors * test(terraform): make ENI destroy compat test runnable |
||
|
|
3b54255d7f |
feat(route53): add Route53 management-plane emulation (#715)
* feat(route53): add Route53 management-plane emulation Implements Route53 Phase 1 with 17 operations: hosted zones (Create, Get, Delete, List, ListByName, Count), resource record sets (ChangeResourceRecordSets, List), change tracking (GetChange), health checks (Create, Get, Delete, List, Update), tagging (ListTagsForResource, ChangeTagsForResource), and GetAccountLimit. Auto-creates SOA and NS apex records on zone creation. Rejects deletion of non-empty zones. All changes return INSYNC immediately. IDs are returned with path prefixes (/hostedzone/Z…, /change/C…) to satisfy the SDK Route53IdInterceptor. Nameservers are configurable via floci.services.route53.default-nameserver[1-4]. Adds OpenTofu and Terraform compatibility tests covering zone creation, A record, auto-created SOA/NS records, health check, and tag persistence. * feat(feat): adding missing endpoints * feat(route53): fix timeout when creating route dns from terraform |
||
|
|
d620c18534 |
fix(ec2): AssociateRouteTable associationState, RouteTable association filters, DescribeTags filters (#706)
- Include <associationState> in AssociateRouteTable response so Terraform v6 waiters can confirm association without timing out - Add association.route-table-association-id, association.subnet-id, association.gateway-id, and association.main filter support to DescribeRouteTables - Apply resource-id, resource-type, key, and value filters in DescribeTags (previously all filters were ignored, returning every tag) - Add RouteTableAssociation.gatewayId field for gateway-id filter support - Add integration tests covering new filters and associationState assertion - Add VPC networking resources to compat-terraform and compat-opentofu suites (IGW, subnet, route table + association, security group) |
||
|
|
d28b175cb0 | fix(ec2): persist VPC DNS attributes and support DescribeVpcEndpointServices (#624) | ||
|
|
473fece1c5 |
fix: RDS DescribeDBInstances returns empty results due to wrong XML element names and missing Filters support (#319)
Fixes #307 Two bugs caused Terraform's aws_db_instance waiter to always report "couldn't find resource": 1. DescribeDBInstances, DescribeDBClusters, and DescribeDBParameterGroups wrapped list items in <member> tags. The AWS SDK Go v2 deserializer expects <DBInstance>, <DBCluster>, and <DBParameterGroup> respectively and silently skips anything else, producing an empty list every time. 2. The Terraform AWS provider v6 polls DescribeDBInstances using Filters.Filter.N.Name=db-instance-id instead of DBInstanceIdentifier. Floci ignored Filters entirely, so the waiter always received all instances regardless of the filter value, causing AssertSingleValueResult to fail when more than one instance existed. Adds a compatibility test covering aws_db_instance create via Terraform. |
||
|
|
c426e805fe | fix(cloudwatch): implement tagging support for metrics and alarms (#320) | ||
|
|
f4f1752b0d |
fix: return 400 when encoded s3 copy source is malformed (#244)
fix: replace silent exception swallowing and add per-test timeout in Python test suite test: misc compatibility-tests cleanups - Added sync comments to both main.tf files - Created compatibility-tests/.dockerignore - Cached CRC32 table in Node setup.ts - Removed >/dev/null 2>&1 from 3 Dockerfiles test: add missing .terraform.lock.hcl chore: remove .terraform.lock.hcl |
||
|
|
eeefb729c4 |
test: move compatibility tests into this repo (#225)
* test: move compatibility tests into this repo * fix: add StatisticValues parsing to CloudWatchMetricsJsonHandler * fix: add missing required abstract methods to EmulatorConfig in EventBridgeSchedulerIntegrationTest * test: add sdk tests for multipart S3 copy coverage * fix: cover and fix smithy cbor and multipart s3 copy regressions * test: migrate more test coverage to new folder * test: add missing ec2 expectation in healthcheck test * docs: update READMEs in `./compatibility-tests` |