Commit Graph
14 Commits
Author SHA1 Message Date
Alex BannaandAlexander Banna bc21367cc4 feat(cloudformation): provision AWS::Events::EventBus as a real custom bus (#1807)
* feat(cloudformation): provision EventBridge event buses

* fix(cloudformation): restore main's provisioner changes lost in the EventBus merge

The previous conflict resolution took this branch's whole
CloudFormationResourceProvisioner, which silently reverted five commits main had
landed on that file since the merge base — including the DynamoDB/Lambda delete
idempotency from #1803 and AWS::EC2::LaunchTemplate from #1973.

Re-resolve from main's file and apply only this branch's EventBus additions on
top: the ownership-tracking provisioner, its validation helpers, and the typed
rethrow in deleteEventBridgeRuleSafe. main's provisionEventBusPolicy and inline
Policy support are kept, with Policy added to EVENT_BUS_SUPPORTED_PROPERTIES so
the inline form is no longer rejected.

* fix(cloudformation): delete EventBus resources created before ownership tracking

deleteEventBusSafe(StackResource) refused to delete whenever the
FlociEventBusCreatedTime attribute was absent, treating "ownership not tracked"
the same as "ownership changed". Stacks provisioned by an earlier Floci build are
restored from cloudformation-stacks.json without that attribute, so the first
DeleteStack after upgrading left them permanently in DELETE_FAILED.

Only refuse when a recorded created-time actually disagrees with the live bus.
A missing attribute falls back to the pre-tracking behaviour of deleting what the
stack recorded it created.

* fix(cloudformation): adopt untracked EventBus on update and record identity before the policy call

Two provision-side defects, both surfaced in review:

UpdateStack broke for stacks provisioned before FlociEventBusCreatedTime existed.
Those resources are restored without the attribute, so the adoption guard's
'existingCreatedTime == null' arm re-threw ResourceAlreadyExists on every update,
including no-ops. Same inverted guard the delete path already uses: only a recorded
time that actually disagrees means the bus was recreated out of band.

The bus also leaked when Policy application failed. r.setPhysicalId ran after
putPermission, and rollbackCreatedResources skips resources whose physicalId is
null, so a malformed policy left a live bus rollback could not find. Identity and
ROLLBACK_OWNED_ATTR are now recorded before the policy call, matching how
provisionIamRole marks a freshly created role. The attribute is cleared on the
adoption path so rollback never deletes a bus this stack did not create.

* chore: re-run CI

Build and Test failed on RuntimeApiServerTest's extension/stop race, a pre-existing
flake unrelated to this change (no CloudFormation test failed). Root-caused separately:
test-timing half in #2141, server-side shutdown-ordering half filed as an issue.

* fix(cloudformation): adopt tagged pre-tracking event buses

* test(dynamodb): retain Quarkus port for cleanup

* chore: rerun CI after download outage

* fix(cloudformation): reject unsafe EventBus policy updates

---------

Co-authored-by: Alexander Banna <abanna@users.noreply.github.com>
2026-08-12 16:38:17 -04:00
Hector Ventura ee15447ba4 docs(cloudformation): document the per-service provisioner path for new resource types (#2153)
New CloudFormation types belong in services/cloudformation/provisioners/, not in the
CloudFormationResourceProvisioner monolith, but nothing outside a gitignored design
doc said so: CONTRIBUTING.md, AGENTS.md, docs/ and the PR template were all silent,
so contributors read the monolith and copied a case.

Adds a step-by-step section to CONTRIBUTING.md and AGENTS.md covering the three
traps behind the recurring review findings: Ref and Fn::GetAtt are separate
mechanisms and a missed attribute resolves to the literal LogicalId.Attr; provision
is also the update path, so creating unconditionally throws AlreadyExists or orphans
the old resource; and an unmapped type is stubbed as CREATE_COMPLETE, so status-only
assertions cannot detect a type that was never wired.

Also refreshes the resource-type table, which had drifted: EC2 gains LaunchTemplate
and VPCGatewayAttachment, EventBridge gains EventBus and EventBusPolicy and its
Events::Rule naming is normalized.
2026-08-07 17:37:36 -05:00
soreavis 7d9b9aedd2 feat(cloudformation): honor resource-level DeletionPolicy (#2167)
A resource's DeletionPolicy attribute was never read off the template,
so every managed resource was deleted regardless of what it declared:
deleteStackResources and rollbackCreatedResources both called
provisioner.delete unconditionally.

Read DeletionPolicy alongside Type in executeTemplate and apply it at
both delete sites. Retain keeps the resource on every stack operation.
RetainExceptOnCreate keeps it too, except when the create that made it
is rolled back — deleting it there is the entire meaning of that value,
and rollbackCreatedResources runs only for a failed create.

A retained resource is reported as DELETE_SKIPPED, on the resource and
as a stack event, and is not counted as a failed delete, so the stack
still reaches DELETE_COMPLETE. That also lets a stack owning a
non-empty S3 bucket be deleted, which otherwise fails on the objects.

Any other value falls through to the existing delete. That includes
Snapshot: floci cannot take the snapshots AWS supports for those types,
and AWS does delete the resource under Snapshot, so Delete is the
faithful half. The docs record that and the other divergences.

The policy is set on the resource after the provisioner returns,
because provision() and executeNestedStack() both return a fresh
StackResource that replaces the map entry.

Closes #1555
2026-08-07 17:29:48 -05:00
Alex Bannaandabanna 62a576c8d4 feat(cloudformation): provision AWS::SecretsManager::SecretTargetAttachment (#1804)
* feat(cloudformation): provision AWS::SecretsManager::SecretTargetAttachment

AWS::SecretsManager::SecretTargetAttachment previously fell through the
default branch, so its Ref yielded a generated placeholder rather than the
secret ARN. Per the CloudFormation resource reference, this resource's Ref
returns the ARN of the secret named in SecretId, and consumers such as
Secret.fromSecretCompleteArn(...) require the complete ARN (with the
trailing -6char suffix).

Resolve SecretId (a Ref to the Secret, a friendly name, or a raw ARN) to
the canonical complete ARN via describeSecret and expose it as the
resource's physical id / Arn attribute, falling back to SecretId as-given
if the lookup fails. Deleting the attachment is a detach no-op — it must
not delete the underlying secret.

* fix(cloudformation): require SecretId on SecretTargetAttachment

SecretId is a required property of AWS::SecretsManager::SecretTargetAttachment.
Resolving it as optional let a template omit it and still create (falling back to
the logical id); reject a missing SecretId instead. Adds a regression test.

* fix(cloudformation): complete secret target attachment lifecycle

* fix(cloudformation): require attachment metadata on delete

* fix(cloudformation): tolerate detached secret overwrites

* fix(cloudformation): align secret target attachment behavior

* docs(cloudformation): document secret target attachments

---------

Co-authored-by: abanna <abanna@users.noreply.github.com>
2026-08-05 17:11:25 -05:00
Alex Banna 4a16266f48 feat(cloudformation): support UpdateTerminationProtection (#1692)
* feat(cloudformation): support UpdateTerminationProtection

CDK bootstrap calls UpdateTerminationProtection on the CDKToolkit stack; Floci returned
UnknownAction. Add it: a boolean enableTerminationProtection on Stack, a
CloudFormationService.updateTerminationProtection(stackName, enabled, region) that sets and
persists it, a handler returning the UpdateTerminationProtectionResult/StackId envelope, and
the flag echoed as <EnableTerminationProtection> in DescribeStacks. Register the action in
AwsQueryController's CloudFormation action set so the Query-protocol POST routes to
CloudFormation instead of falling through. Adds an integration test toggling the flag and
asserting it round-trips through DescribeStacks.

* docs: regenerate action tables
2026-07-09 00:16:38 -05:00
TiM 7d70f64162 feat(docs): generate Supported Actions tables from handler source (#1641)
* feat(docs): generate Supported Actions tables from handler source

The "Supported Actions" tables in docs/services/*.md were hand-maintained and
drifted from the handlers. For example secrets-manager.md omitted RestoreSecret,
which SecretsManagerJsonHandler dispatches, and acm.md listed RenewCertificate,
which is not implemented anywhere in src/.

Derive the action list from handler source so it cannot drift, while keeping the
hand-written Description column:

- tools/docs/regen_action_docs.py extracts actions from `case "X" ->` switch arms
  (including multi-label arms) and JAX-RS REST controllers, and rewrites only the
  rows between the <!-- floci:actions --> markers. Descriptions are preserved by
  action name; new actions get a "-" placeholder. PascalCase-only matching avoids
  picking up SCREAMING_CASE labels from non-action switches.
- tools/docs/services.yaml registers 18 single-table switch services and lists the
  remaining switch handlers under deferred_handlers, so the new-service sentinel
  fires only on a genuinely unregistered handler.
- make docs-sync / docs-check / docs-test, plus a Python-only CI workflow that
  gates on handler, doc, and tooling changes.
- Migrate 18 service docs into marker blocks, reconciling real drift (adds
  RestoreSecret, ImportCertificate, and others; drops the unimplemented
  RenewCertificate).

Revives the parser and CI gate from #738 by @ericbsantana and completes the
description-preservation its spec described. REST-mode, mixed-mode, multi-table,
non-tabular, S3, and ecr docs are deferred and tracked in deferred_handlers.

* docs: drop standalone design spec from action-docs tooling

Remove ideas/auto-generated-action-tables.spec.md and the four references
to it (CONTRIBUTING.md, Makefile, regen_action_docs.py docstring,
services.yaml). It was a planning artifact; the operational docs live in
CONTRIBUTING.md and the tooling is self-documenting. The #738 / @ericbsantana
credit is preserved in the PR description.

* chore: address review on action-docs tooling

- pin actions/checkout to v7.0.0 in docs-actions workflow to match the
  repo-wide bump (#1690), so dependabot does not immediately flag the new file
- document in the generator docstring that a switch case label counts as
  supported purely by existing, so a per-action UnsupportedOperation stub
  would be a false positive (handlers here reject from the default arm)

* docs: regenerate action tables against current handler source

Resync the generated Supported Actions tables to handler source after
rebasing onto the latest main:

- cloudformation: add DescribeStackInstance and DescribeStackSetOperation
  now emitted by the handler, and keep the implemented StackSet descriptions
- cloudtrail: add LookupEvents
- firehose: add UpdateDestination
- step-functions: add PublishStateMachineVersion, ListStateMachineVersions,
  DeleteStateMachineVersion
- register the cloudcontrol handler in deferred_handlers so the strict
  unregistered-handler gate passes (no standalone action table yet)

* fix(docs): prevent action-table generator from silently dropping actions

Address the latest review pass on the action-docs tooling:

- switch extraction now captures case arms whose labels wrap across lines
  (valid Java 14+ syntax). The capture group excludes only `{ } ;` boundaries,
  so it spans newlines between labels but stops at the arm's `->`. A wrapped
  arm was previously missed, and docs-check would stay green because the doc
  and the generated output agreed on the omission, defeating the whole
  drift-prevention guarantee.
- REST extraction skips Javadoc / inline comments between a verb annotation
  and the method signature; such a line otherwise reset the lookahead and
  dropped the action.
- parse_marker_block raises a descriptive error when a marker is not on its
  own line, instead of a bare "substring not found".
- doc, source, and registry reads/writes are pinned to UTF-8 so generation is
  locale-independent (the docs contain non-ASCII text).
- the docs-actions push trigger watches Makefile and the workflow file,
  matching its pull_request trigger.

Adds regression tests for the multi-line arm and comment-skip paths (20 total).
2026-07-06 21:02:04 -05:00
Alex Banna 058e02630a feat(cloudformation): add StackSets with account-aware provisioning (#1551)
* feat(cloudformation): add StackSets with account-aware provisioning

Implement CloudFormation StackSets so a template can be deployed across
target accounts and regions, and make CloudFormation provisioning land
resources in the correct account.

Provisioning previously ran on a background executor thread with no request
scope, so the downstream service calls fell back to the default account — a
stack created by account B materialised its resources under 000000000000.
executeChangeSet/deleteStack now run the provisioning under a synthetic
request scope bound to the deploying account (the caller's account for a
single stack, the target account for a StackSet instance), mirroring the
pattern other background workers already use. Single-stack resources now
land in the caller's account.

StackSet actions are wired through CloudFormationQueryHandler and
AwsQueryController: CreateStackSet, DescribeStackSet, ListStackSets,
UpdateStackSet, DeleteStackSet, CreateStackInstances, ListStackInstances,
DeleteStackInstances, ListStackSetOperations. CreateStackInstances drives
the existing single-stack engine once per target (account, region),
provisioning each instance into that account's namespace; the stack set,
its instances and its operation history live in the administration account.

Tests: an integration test deploying a StackSet from an admin account into
accounts B and C asserts the resources materialise in B and C and are
invisible to the admin/default account, exercises describe/list/operations
and instance deletion, and covers the not-found / already-exists /
not-empty error paths. A single-stack test asserts resources now land in
the caller's account.

Design aligned with maintainers in floci-io/floci#1550.

* fix(cloudformation): await StackSet instance deletion; test UpdateStackSet

Make the account-scoped deleteStack overload return its Future so
DeleteStackInstances completes synchronously before the operation returns,
rather than racing the async resource removal. Add integration coverage for
UpdateStackSet re-applying the template to existing instances.

* test(cloudformation): add SDK compatibility test for StackSets

Adds an sdk-test-java compatibility test exercising StackSets through the real
AWS SDK CloudFormationClient (CreateStackSet, CreateStackInstances,
DescribeStackSet, ListStackInstances, ListStackSetOperations,
DeleteStackInstances, DeleteStackSet). It asserts the management responses
unmarshal cleanly and that instances provision into each target account's
namespace (verified via per-account SQS clients), per the project's policy of
validating management APIs with AWS SDK clients. Runs in the compatibility CI
on pull requests.

* feat(cloudformation): add DescribeStackInstance and DescribeStackSetOperation

Complete the StackSets API surface with the singular describe operations:
DescribeStackInstance (used by orchestration that polls a single instance's
status) and DescribeStackSetOperation (companion to ListStackSetOperations).
Covered by the integration test and the SDK compatibility test, which confirm
the StackInstance / StackSetOperation response shapes unmarshal through the
real AWS SDK.

* feat(cloudformation): resolve TemplateURL and report StackInstanceStatus.DetailedStatus for StackSets

StackSet create/update now resolve a TemplateURL (fetched from S3) in addition
to an inline TemplateBody, matching how orchestration tools reference templates
staged in S3. DescribeStackInstance and ListStackInstances now also report the
nested StackInstanceStatus.DetailedStatus that AWS returns and that pollers read
to determine when an instance operation has completed.

* feat(cloudformation): derive StackSet operation status and honor RetainStacks

Address review feedback on #1551:

- Operation status is now derived from instance outcomes: CreateStackInstances
  and UpdateStackSet report FAILED if any instance fails to deploy, instead of
  always SUCCEEDED. deployInstance also recognizes a rolled-back create
  (ROLLBACK_COMPLETE, not *_FAILED) as a failed/INOPERABLE instance, which was
  previously mis-reported as SUCCEEDED.
- DeleteStackInstances honors RetainStacks: when true, the instance is detached
  from the stack set but its underlying stack and resources are left in place.
- UpdateStackSet now persists the refreshed instance records.

Tests: RetainStacks retention and the FAILED-operation path; docs updated.

* fix(cloudformation): restore account on active scope; log StackSets test teardown

Greptile review on #1551:
- runUnderAccount now saves and restores the previous account ID when it runs
  inside an already-active request scope, so it can't leave the overridden
  account behind on a reused thread. (Background workers normally have no active
  scope, so this only hardens the synchronous-caller path.)
- CloudFormationStackSetsTest teardown no longer swallows exceptions silently;
  it logs them, per the AGENTS.md no-empty-catch rule.

* fix(cloudformation): report a failed StackSet instance delete as FAILED

deleteStackInstances awaited the underlying deleteStack via a helper that
swallows the failure, then removed the instance record unconditionally and
hardcoded the operation status to SUCCEEDED. A failed non-retained delete was
therefore reported as a success with the instance silently dropped.

await() now returns whether the future completed cleanly. On a non-retained
delete failure the instance record is retained (marked INOPERABLE/FAILED) and
the operation status is derived via deriveOperationStatus, so it reports FAILED
— matching AWS, which does not detach an instance whose stack delete failed.

Adds StackSetServiceDeleteFailureTest covering the failure, success, and
RetainStacks paths.

* fix(cloudformation): reject templateless CreateStackSet and restore interrupt in await

CreateStackSet now rejects a request with neither TemplateBody nor TemplateURL (ValidationError,
matching AWS) instead of storing a null template — which would otherwise make a later
CreateStackInstances deploy empty stacks into every target account. Also handle
InterruptedException separately in await(Future) and restore the thread's interrupt flag, so a
shutdown signal to the backing ExecutorService propagates instead of being swallowed. Adds a
CreateStackSet-without-template integration test.
2026-07-01 23:11:16 -05:00
Hector Ventura e17a8fce36 docs(cloudformation): sync supported resource types and annotate stub actions (#1405)
Update docs/services/cloudformation.md to reflect current provisioner coverage (~74 AWS::* types incl. EC2, RDS, EKS, ELBv2, AutoScaling, Kinesis, Firehose, CloudWatch/Logs, Cognito, Batch, Step Functions, full API Gateway). Correct Route53 (now provisioned, not stubbed) and group types by service. Annotate stub/no-op actions (ValidateTemplate, Set/GetStackPolicy, StackSet ops).
2026-06-17 00:50:16 -05:00
Hector Ventura 9e35046647 Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml
* docs: sync with main and new features
* docs: reverting docker-compose.yml
2026-05-10 11:53:31 -05:00
Chris Wright 271f27da62 fix(cfn): reconcile lambda functions on update (#736) 2026-05-07 20:49:45 -05:00
Hector Ventura f30bd79d67 chore: release 1.5.10 2026-04-30 00:59:04 -05:00
TiM a32b7f1f3b docs: comprehensive audit sweep + CHANGELOG backfill (1.1.0-1.5.2) (#326)
CHANGELOG.md was empty for the 1.1.0-1.5.2 release cycle and service docs
had drifted from code behaviour. This sweep reconciles docs against the
current codebase on upstream/main.

- Backfill CHANGELOG.md for 1.1.0 through 1.5.2 from git history
- Correct exact operation counts in docs/services/index.md: S3 (~30 -> 58),
  Lambda (~25 -> 30), API Gateway v1 (~24 -> 62). Counts now come from the
  actual dispatch handlers rather than @Path annotation counts.
- Rewrite README "Supported Services" table to drop per-service op counts
  (they drift too fast); point readers at docs/services/index.md
- Update 24 service docs for accuracy, add "Not Implemented" sections
  where relevant (s3.md, lambda.md, api-gateway.md)
- Refresh configuration and getting-started docs
- Add EventBridge Scheduler and AppConfig to mkdocs nav
- Add AppConfig / AppConfigData rows to README and services index
  following the 1.5.2 upstream release
2026-04-10 10:52:34 -05:00
Benjamin Hintz 794939c331 Add support for CloudFormation's DeleteChangeSet 2026-03-24 17:06:01 +01:00
Hector Ventura 61433f59ab firt commit 2026-03-15 17:43:56 -05:00