mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
43eace4e026ba088a6583baccc68a161663b0170
47
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
460aa0718e |
feat(cloudwatch): provision AWS::CloudWatch::Dashboard (#3231)
* feat(cloudwatch): provision AWS::CloudWatch::Dashboard The dashboard name is the physical id, generated when the template gives none and kept across updates. An update with the same name puts the body again and drives the tags to the template's set, since PutDashboard leaves an existing dashboard's tags alone. A changed name creates the new dashboard and leaves the displaced one to the ReplacementCleanup record, which deletes it once the update commits or restores it on rollback. The body may be written as a JSON object in the template and is stored as the string the API takes. The CloudWatch docs now list the dashboard and tag actions the handlers already serve. * fix(cloudwatch): roll back in-place dashboard updates and replace a dashboard whose explicit name is dropped An in-place update keeps the body and tags it replaces on the resource, or the fact that the dashboard did not exist, and a failed stack update puts them back in full. The name mode is recorded as the Logs provisioner does, so a template that drops an explicit DashboardName gets a generated name and a replacement, as on AWS, while an unnamed dashboard keeps its generated name. The Tags list is checked against the schema's cap of 50 on every provision, since the tag operations an update reconciles through do not enforce it. The integration test reads stack events with XmlParser. * fix(cloudwatch): keep the dashboard rollback snapshot until the restore succeeds A restore that throws left no snapshot behind, so the next rollback attempt reported success without restoring anything. The snapshot is now spent only after the body and tags are back. * fix(cloudwatch): unwind a dashboard update that failed after it changed the body An in-place update puts the body and then reconciles the tags. When the tag calls failed, the exception left the dashboard carrying the new body while CloudFormationService put the resource the stack held before the attempt back in its place. That object never carried the snapshot taken by the attempt, so the walker marked it restored and skipped rollbackUpdate: the stack reported a completed rollback over a dashboard that still had the update's body, or a half reconciled set of tags. The mutating calls now unwind themselves through rollbackUpdate, the way IotDomainConfigurationCfnProvisioner unwinds a replacement, and report the resource restored. An unwind that cannot put the body back keeps the snapshot and records the failure on the resource, so the stack ends in UPDATE_ROLLBACK_FAILED rather than claiming the prior dashboard is intact, and the original failure is still what the stack reports. Tests: anInPlaceUpdateThatFailedOnItsTagsPutsTheBodyBack, anUnwoundInPlaceUpdateIsMarkedRestored, anUnwindThatCannotRestoreIsReportedAsARollbackFailure. * fix(cloudwatch): record a dashboard unwind failure before joining it to the update failure The unwind repeats the tag call the update just made, so a service that keeps failing hands the unwind the very exception that interrupted the update. Throwable.addSuppressed rejects a throwable suppressed under itself, and that IllegalArgumentException escaped the unwind before the rollback failure was recorded: the dispatcher reported "Self-suppression not permitted" as the resource failure, no failure attribute reached the stored resource, and the stack ended UPDATE_ROLLBACK_COMPLETE over a dashboard whose tags were never put back. The failure attribute is now written first and the two exceptions are joined only when they differ, as PipesCfnProvisioner does. Two stack-level tests drive the whole path through CloudFormationService with a spied CloudWatchDashboardsService, the way CloudFormationPipesCleanupIntegrationTest does: a one-off tag failure ends in UPDATE_ROLLBACK_COMPLETE with the prior body and tags live, a persistent one in UPDATE_ROLLBACK_FAILED naming the dashboard and carrying the unwind's reason. Tests: anUnwindThatFailsWithTheUpdatesOwnExceptionIsStillRecorded, anUpdateThatFailedOnItsTagsPutsTheDashboardBackAndTheStackRollsBackCleanly, aFailedRestoreLeavesTheStackInUpdateRollbackFailedNamingTheDashboard. |
||
|
|
895adce214 |
fix(cloudformation): provision CloudFront policies and origin access controls (#3228)
* fix(cloudformation): provision CloudFront policies and origin access controls AWS::CloudFront::ResponseHeadersPolicy, CachePolicy, OriginRequestPolicy and OriginAccessControl had no provisioner, so the dispatcher's stub arm reported CREATE_COMPLETE with a synthetic id and a distribution that referenced it failed with "The specified response headers policy does not exist." A new CloudFrontCfnProvisioner creates each type through CloudFrontService: the physical id is the service id, Fn::GetAtt exposes Id and LastModifiedTime (Id only for the origin access control, per the registry schemas), updates go through the service's etag-guarded update, and deletes tolerate only the type's own not-found code so an in-use policy fails the stack delete as on AWS. The response headers configuration is reshaped into the flattened form the service's codec stores through the new ResponseHeadersPolicyConfigCodec.fromItemsTree. Closes #2441 * fix(cloudfront): reject deleting a cache or origin request policy in use DeleteCachePolicy declares CachePolicyInUse and DeleteOriginRequestPolicy declares OriginRequestPolicyInUse, both 409 sender faults, and both are documented as refusing the delete while the policy is attached to a cache behavior. Floci checked only two of the four policy-shaped types: deleteResponseHeadersPolicy and deleteOriginAccessControl raised their in-use errors, while these two deleted unconditionally once the etag matched. A policy still referenced by a distribution could be removed, leaving that distribution pointing at something that no longer existed. Both now raise the modeled error after the etag check, matching the ordering the other two deletes already use. Cache, origin request and response headers policies all hang off the same two places, a distribution's default cache behavior and its ordered ones, so the three near-identical scans collapse into one helper that differs only in which id it reads. The per-distribution association count keeps its own entry point, since it asks about one config at a time and can be handed a distribution with none. Found while reviewing the CloudFormation provisioner in this PR, which was already written for this: its delete tolerates only NoSuch<Type>, so it fails the stack correctly now that the service raises the in-use error. The CloudFormation integration test covers that end to end: it attaches both policies to a distribution and still deletes the stack cleanly, because CloudFormation removes the distribution before the policies it references. Four tests: a cache policy attached to a default behavior and to an ordered one, an origin request policy in use, and an unattached policy still deleting. * test(cloudformation): parse stack outputs with XmlParser The CloudFront policies integration test pulled Outputs out of the DescribeStacks response with two regular expressions over <member> and <OutputValue> blocks. XmlParser.extractPairs already does exactly this, and seventeen sibling CloudFormation integration tests define the same one-line helper over it, so the twelve-line version was reinventing a shared utility. It also matches the repo's rule against parsing XML with regex. Behaviour is unchanged, including the failure message that names the missing key. * fix(cloudformation): roll back a recreated CloudFront policy on a failed update When an update finds the prior policy or origin access control already deleted out of band, the provisioner recreates it under a new physical id. If a later resource then failed the stack update, the rollback left that new object behind: the engine only deletes resources the update ADDED, inside the previous == null branch of rollbackUpdatedResources, so an existing resource that merely acquired a new physical id fell through to the "Rollback is not implemented" arm, which deletes nothing. ReplacementCleanup already models exactly this, and CognitoCfnProvisioner wires it for the same situation, so the provisioner records the displaced entity after each provision and delegates the cleanup hooks and rollbackUpdate to it. A rollback now names the prior id again with the attributes it carried and deletes the object the failed update created. The physical id changes here only when the prior object was already gone, since prior() returns the entity whenever the service still knows it, so the recorded displaced entity is always one that no longer exists and its cleanup delete is a no-op tolerated by the type's not-found code. The hooks are still needed, or a recorded entity would stay owed a delete forever. An in-place update keeps its physical id, so nothing is recorded and rollbackUpdate answers false: putting a committed in-place change back needs a configuration snapshot this provisioner does not keep, the same limitation AWS::Cognito::UserPool has. A test pins that so it stays a decision. Raised by the review on this PR. My first reply argued the finding did not hold, generalising from the create path; that was wrong for this one, and the correction is on the thread. |
||
|
|
fd3c4d9ab6 |
feat(cloudtrail): support AdvancedEventSelectors and CloudFormation Trail provisioning (#2720)
* feat(cloudtrail): support AdvancedEventSelectors in PutEventSelectors and S3 capture Adds AdvancedEventSelector/AdvancedFieldSelector models, JSON wiring through PutEventSelectors/GetEventSelectors, mutual-exclusivity enforcement against basic EventSelectors, and field-selector evaluation (Equals/NotEquals/StartsWith/NotStartsWith/EndsWith/NotEndsWith) in the S3 data-event capture path. Lets a trail exclude its own log-delivery bucket via resources.ARN NotStartsWith, avoiding the CloudTrail circular-logging cost problem. Basic-selector behavior is unchanged. * feat(cloudtrail): add CloudFormation provisioner for AWS::CloudTrail::Trail Handles create/update/delete of AWS::CloudTrail::Trail via CloudTrailService, applies EventSelectors or AdvancedEventSelectors (mutually exclusive, same JSON shapes as PutEventSelectors), starts logging when IsLogging is true, and sets the trail ARN as the resource's physical id and Arn attribute. Delete is idempotent when the trail is already gone. * feat(cloudtrail): implement ListTrails and trail tagging Adds ListTrails (returns Name/TrailARN/HomeRegion for trails visible in the region, including multi-region trails), plus AddTags/ListTags backed by per-trail stored state, keyed by trail name or ARN. * fix(cloudtrail): emit data events for the trail's own log deliveries CloudTrailLogWriter.flushTrail() wrote delivered log files via a direct S3Service.putObject() call, bypassing S3Controller.emitCloudTrailEvent() - the only place that recorded an S3 data event. A trail whose selector matched its own destination bucket (the exact circular-logging config from upstream issue #1192 / PR #1194) never saw its own deliveries, so the emulator could prove the dangerous config was live but not reproduce the loop it causes. flushTrail now calls cloudTrailService.emitS3DataEvent() after each delivery, so internal writes are evaluated against selectors identically to API-driven ones. Closes issues/0034. * docs: mark issue 0034 fixed * fix(cloudtrail): resources.type reflects actual S3 resource, not hardcoded object Advanced selector matching hardcoded resources.type to AWS::S3::Object for every event, so an object-scoped AdvancedEventSelectors exclusion (the real-world fix for the issue 0034 self-delivery loop) still let bucket-level calls like ListObjects through against the excluded bucket. Now derived per event from whether an object key is present. Live-verified on 1160-ct: loop confirmed unbounded and compounding with external writes, then confirmed stopped by the real AdvancedEventSelectors remediation, with this gap found and closed in the same pass. Details in issues/0034 and issues/0035. * docs(0034): add raw delivery-size timeline from 1160-ct verification Per-cycle size data showing the burst-compounding and the fix-stop point concretely, not just summarized. * fix(cloudtrail): match delete() to current CfnResourceProvisioner signature Upstream/main dropped the accountId parameter from CfnResourceProvisioner.delete() since this branch was originally authored; the provisioner never used accountId in its body, so the fix is a straight signature match with no behavior change. * docs(cloudtrail): regen action table and register CFN Trail resource type New ListTrails/AddTags/ListTags actions and the CloudFormation AWS::CloudTrail::Trail resource type need doc entries per the repo's docs-check gate. * fix(cloudtrail): enforce AddTags 200-tag list limit Botocore's AddTagsRequest.TagsList models a 200-item max (service-2.json, cloudtrail 2013-11-01); the handler accepted an unbounded list. RED test added first (addTagsRejectsMoreThanTwoHundredTags), confirmed failing (200 instead of 400), then fixed by rejecting oversized lists with TagsLimitExceededException, matching AWS's modeled error for AddTags. * fix(cloudformation): close two audit-control gaps in CloudTrailCfnProvisioner Local code review flagged two HIGH findings in the new CFN provisioner: - physicalId was only set after selector validation and startLogging succeeded, so a create that failed on the mutually-exclusive EventSelectors/AdvancedEventSelectors check left a real trail with no recorded physical id for the engine to clean up. Now set immediately after createTrail returns. - update only called startLogging when IsLogging was explicitly true, never stopLogging when it was explicitly false, so a template setting IsLogging: false on a currently-logging trail silently left logging enabled. RED tests confirmed both failures against the pre-fix code, then GREEN after the fix (6/6 provisioner tests, 51/51 CloudTrail suite). * docs(issues): ledger deferred CloudTrail local-review findings MEDIUM/LOW findings from the local code-review pass, plus a few inherited-not-ours items on code this branch didn't touch, that are real but out of scope for the CFN provisioner / advanced-selectors PR. * style(cloudtrail): brace unbraced conditionals in ListTrails and event-matching traversal Per AGENTS.md style rule (always use braces in conditionals). * fix(cloudtrail): avoid NPE on List.of(trailName) when TrailName is missing PutEventSelectors/GetEventSelectors called List.of(trailName) with a possibly-null trailName before findTrailOrThrow could validate it, throwing an NPE (500 InternalFailure) instead of the modeled TrailNotFoundException. Guard the lookup so the null flows through to the existing validation. * fix(cloudtrail): do not re-queue records on self-delivery emission failure flushTrail wrapped the self-delivery emitS3DataEvent call in the same try/catch as the S3 write. A failure there re-queued records that were already durably written, causing the next flush to redeliver the same batch. Split the write and the emission into separate try blocks so only a write failure triggers requeue. * docs(cloudformation): register AWS::CloudTrail::Trail in the resource-type inventory CfnResourceInventoryTest and the docs-sync resource-type table both derived from supported-resource-types.tsv, which never picked up CloudTrailCfnProvisioner's registration. * docs(issues): drop fork-local ledger files from the PR Per maintainer review, the issues/ ledger entries are fork-local tracking notes and are kept out of the upstream contribution. * fix(cloudformation): wire CloudTrailCfnProvisioner into CfnProvisionerFixture CfnProvisionerFixtureTest.everyProvisionerIsReachableThroughThePublicBuilderOrExplicitlyExempt failed because CloudTrailCfnProvisioner had no field, setter, or construction arm in the test fixture, so a test naming CloudTrailService would silently fall through to the stub arm instead of exercising the real provisioner. Add cloudTrailService field, cloudTrail(CloudTrailService) setter, and the discovered.add(new CloudTrailCfnProvisioner(...)) construction arm, mirroring the existing Route53Service wiring. * fix(cloudtrail): drop em-dashes from new test comments per AGENTS.md style check * fix(cloudtrail): reject mixed basic and advanced selectors with InvalidEventSelectorsException PutEventSelectors does not model InvalidParameterCombinationException; the error it declares for an invalid selector combination is InvalidEventSelectorsException (botocore cloudtrail/2013-11-01). Both the JSON handler and the AWS::CloudTrail::Trail provisioner now throw that code, and the integration test pins it. Also braces the remaining one-line conditionals in matchesAdvancedFieldSelector. |
||
|
|
af42564cb3 |
feat(lambda): provision AWS::Lambda::EventInvokeConfig (#3230)
* feat(lambda): provision AWS::Lambda::EventInvokeConfig The physical id is the registry schema's composite FunctionName|Qualifier identifier. A create puts the configuration, an update with the same identity applies the template's settings through the merge-style update call, and a changed function or qualifier is a replacement whose displaced configuration the ReplacementCleanup record deletes once the update commits or restores on rollback. The schema's MaximumRetryAttempts and MaximumEventAgeInSeconds bounds are checked before any call, as CloudFormation validates them before the handler runs. The Lambda docs now list the five event invoke config operations, which the page wrongly called not implemented, and say that asynchronous invocations do not yet apply the settings. * fix(lambda): update the event invoke config in place for equivalent names and roll back in-place changes A short name and the function's ARN address one configuration, so an update that changes between them updates in place under the prior physical id instead of recording a replacement whose cleanup would delete that one configuration. An in-place update keeps the settings it replaces on the resource, and a failed stack update puts them back in full. DestinationConfig is resolved before it is looked at, so a conditional that resolves to AWS::NoValue is omitted rather than sent as an empty destination set. The integration test reads stack events with XmlParser. * fix(lambda): keep the event invoke config rollback snapshot until the restore succeeds A restore that throws left no snapshot behind, so the next rollback attempt reported success without restoring anything. The snapshot is now spent only after the settings are back. |
||
|
|
0321ae0ac8 |
refactor(cloudformation): move Cognito UserPool and UserPoolClient to CognitoCfnProvisioner (#3164)
* refactor(cloudformation): move Cognito UserPool and UserPoolClient to CognitoCfnProvisioner
Batch 3 of the CloudFormationResourceProvisioner split. AWS::Cognito::UserPool and
AWS::Cognito::UserPoolClient join the provisioner that already owns UserPoolDomain;
the two arms, their switch cases, the type-list entries, the Cognito-only
resolveStringMapOrNull helper and the CognitoService dependency leave the monolith.
Behaviour is preserved except for what the split's conventions require:
- the create/update branch reads ctx.isUpdate() instead of the resource's physical
id, which provision overwrites as it runs
- deletes go through CfnDeletes.safeDelete tolerating only ResourceNotFoundException;
a pool that still has a domain keeps failing the stack delete with
InvalidParameterException, as on AWS
- the client also exposes Name, the read-only attribute the registry schema declares
(ClientName stays for now), so CfnSchemaCoverageTest needs no gaps row
- the ReplacementCleanup hooks are wired for both types; nothing replaces yet, so
they are inert until create-only properties are honoured
The unit test covers both types with a mocked service: request map and generated
names, update carrying the prior id, the exact attribute sets, positional client
arguments, and delete tolerance. The domain delete path now branches on type first,
since a pool resource also carries a UserPoolId attribute.
* fix(cloudformation): replace a Cognito user pool client when its create-only properties change
UserPoolId and GenerateSecret are createOnlyProperties in the AWS::Cognito::UserPoolClient
registry schema: on AWS a change to either creates a new client and deletes the old one
after the update commits. The provisioner passed the new pool id to UpdateUserPoolClient,
which fails with ResourceNotFoundException because a client is only found through the
pool that owns it, and a changed GenerateSecret was silently ignored since the update
call has no such parameter.
The provisioner now looks the prior client up by id, updates in place only when both
create-only properties are unchanged, and otherwise creates the replacement; the
ReplacementCleanup record deletes the displaced client once the update completes or
restores it on rollback. A prior client that is already gone is created anew. The by-id
describeUserPoolClient overload is new on CognitoService, mirroring its delete pair.
* fix(cloudformation): resolve Cognito UserPoolTags as the map the schema declares
AWS::Cognito::UserPool.UserPoolTags is an object (the type's tagProperty), not the
[{Key, Value}] list most types carry. The provisioner parsed it with the list helper,
which yields nothing for a map, so the tags only reached the service through the raw
property map, where a non-string tag value arrives as a number. The tags are now
resolved as a string map and put explicitly, on create and on update.
* fix(cloudformation): give Fn::GetAtt ProviderName on a Cognito user pool AWS's shape
The attribute returned the pool name. On AWS it is cognito-idp.<region>.amazonaws.com/<pool id>,
the value templates feed into an identity pool's CognitoIdentityProviders (CDK derives the
same string in UserPool.fromUserPoolArn). ProviderURL deliberately stays Floci's local
issuer, <base-url>/<pool id>, since that is the iss of the tokens Floci mints and a template
wiring it into a JWT authorizer must validate locally; the generated resource-type table
now says so.
* fix(cognito): apply PoolName on UpdateUserPool so a CloudFormation rename takes effect
UpdateUserPoolRequest carries PoolName in the service model and AWS::Cognito::UserPool
lists UserPoolName as updatable in place, but updateUserPool only ran populateUserPool,
which never sets the name, so a renamed pool kept its old name through both the API and
a stack update. The service now applies a non-blank PoolName.
The provisioner sends PoolName on update only when the template names the pool: an
unnamed pool keeps the name its first execution generated instead of being renamed to a
freshly generated one on every update.
* fix(cloudformation): expose only the schema's attributes on a Cognito user pool client
The AWS::Cognito::UserPoolClient registry schema declares ClientId, Name and ClientSecret
as its read-only properties. ClientName is a request property, not an attribute; on AWS
Fn::GetAtt Client.ClientName fails template validation, so no working template depends on
it. It is dropped in favour of Name.
* fix(cloudformation): validate Cognito user pool client properties instead of dropping them
A non-integer AccessTokenValidity, IdTokenValidity or RefreshTokenValidity was parsed to
null and silently ignored, so the template's intent was lost without a word. The
provisioner now fails the resource with ValidationError "Value of property X must be an
integer.", as the ECS provisioner does for DesiredCount. UserPoolId, the schema's one
required property, is likewise rejected when missing rather than passed through as null.
* test(cloudformation): cover Cognito user pool client replacement end to end
Through the CloudFormation API: a client moved to another pool and one whose
GenerateSecret flips are each replaced, with the displaced client gone once the update
completes; a rename updates the client in place; Fn::GetAtt Name and the pool's
ProviderName carry their AWS shapes; deleting the stack removes client and pools.
* fix(cloudformation): drop a stale ClientSecret attribute when a replacement client has none
The engine hands an update the prior attributes, and the provisioner only wrote
ClientSecret when the new client had one, so replacing a secret-bearing client with
GenerateSecret: false left the displaced client's secret readable through Fn::GetAtt.
The attribute is now removed when the client has no secret; rollback still restores it
from the cleanup record's snapshot.
* fix(cloudformation): refuse a Cognito client replacement that would reuse the prior client id
AWS client ids are random, so a replacement never collides with the client it replaces.
Under Floci's floci:override-cognito-client-id tag the id follows the client name, and a
replacement that kept the name (a GenerateSecret flip, or a move to a pool with the same
override) was created under the prior id: the store overwrote the prior client, the cleanup
record saw an unchanged id and recorded nothing, and the update could not be rolled back.
Neither overwriting nor delete-then-create can preserve the prior client, so the update is
now refused with ValidationError before anything changes and the stack rolls back intact.
CognitoService gains deterministicClientIdFor(userPoolId, clientName), sharing the id rule
with createUserPoolClient; the provisioner compares it with the prior id in the replacement
branch only.
* fix(cloudformation): refuse a Cognito client whose derived id another client already holds
The round-1 guard compared the derived id only with the client being replaced. Under
floci:override-cognito-client-id the store is keyed by client id alone, so a name whose
derived id belongs to any other client, in this pool or another, would overwrite that client
on create, and neither the cleanup record nor rollback knows about it. The guard now refuses
whenever an existing client holds the derived id, on a fresh create as well as a replacement.
* fix(cloudformation): make the deterministic Cognito client-id guard atomic and ignore orphaned records
Two gaps in the round-2 guard. CloudFormationService runs stack operations on a cached
thread pool and CognitoService's client store write is unconditional, so two stacks could
both find a derived id free and the later create overwrote the earlier stack's client; the
existence check and the create now run under one lock whenever the id is derived from the
name. And deleting a user pool does not remove its clients yet (#2949 adds that), so a client
of a deleted pool kept its derived id and the guard refused a legitimate create in another
pool; a holder whose pool no longer exists is now treated as a stale record the create may
take over. Random ids take neither path.
|
||
|
|
631df1dc01 |
feat(cloudformation): provision AWS::Backup::BackupVault (#3125)
Per-service provisioner over BackupService. Ref and Fn::GetAtt BackupVaultName are the vault name and Fn::GetAtt BackupVaultArn its ARN. The name is the physical id and createOnly, so an unnamed vault keeps its generated name across updates instead of getting a second vault, and a rename is refused as a replacement. EncryptionKeyArn is createOnly as well. BackupVaultTags are driven to the template's set on update, untagging dropped keys since TagResource only adds. Stack deletion deletes the vault and leaves the non-empty-vault refusal to surface as on AWS. The docs generator gains a label and row position for the new AWS::Backup namespace. Ported from lex00/floci#118. Tracked in lex00/floci#192. |
||
|
|
3a4982c294 |
feat(cloudformation): provision AWS::ApiGateway::UsagePlan and UsagePlanKey (#3123)
* feat(cloudformation): provision AWS::ApiGateway::UsagePlan and UsagePlanKey Per-service provisioner over ApiGatewayService. A plan's Ref and Fn::GetAtt Id are the plan id. Every plan property is mutable, so an update patches name and description in place and adds or removes API stages as the template moves them. Tags are driven to the template's desired state through the new replaceUsagePlanTags. A key's Ref and Fn::GetAtt Id are <keyId>:<usagePlanId>, as on AWS. All three of its properties are createOnly, so a change to any of them is refused as a replacement rather than re-associating a different key under the old id. The composite id is what lets delete find the association without scanning every plan. Stack deletion removes the plan and the association and tolerates either being gone already. Ported from lex00/floci#118. Tracked in lex00/floci#192. * fix(cloudformation): validate usage plan key properties and survive a recreated plan An association only counts as still there while its plan does. deleteUsagePlan leaves associations behind, and a plan recreated after an out-of-band delete has a new id, so the stale association no longer reads the new UsagePlanId as a rename. KeyType must be API_KEY and both ids must be present, per the registry schema, and a non-list ApiStages is refused instead of read as empty. replaceUsagePlanTags strips the reserved id-override tags the way createUsagePlan does rather than refusing them. * fix(cloudformation): check a usage plan key's KeyId even while recovering drift The createOnly checks sat behind the association lookup, so a template that changed KeyId while its plan was missing created an association for the new key instead of refusing the change. KeyId is checked against the prior composite id either way now. UsagePlanId stays conditional, since a plan recreated after an out-of-band delete legitimately has a new id. |
||
|
|
17af9590c7 |
feat(cloudformation): provision AWS::AutoScaling::ScalingPolicy (#3124)
* feat(cloudformation): provision AWS::AutoScaling::ScalingPolicy Per-service provisioner over AutoScalingService. Ref and Fn::GetAtt Arn are the policy ARN and Fn::GetAtt PolicyName the generated name, since the type has no PolicyName property. PutScalingPolicy is an upsert keyed by group and name, so an update reuses the name recorded at create time and rewrites the policy in place. AutoScalingGroupName is createOnly, so moving the policy to another group is refused as a replacement rather than left behind on the old group. Omitted ScalingAdjustment and Cooldown take the Query handler's defaults. Ported from lex00/floci#118. Tracked in lex00/floci#192. * fix(cloudformation): scope the scaling policy lookup to its group Policy names are unique only within a group. The update path now looks for the recorded name on the template's group first and treats a same-named policy on another group as a move only when it is not there, so an unrelated group's policy cannot block a valid update. * fix(cloudformation): take a scaling policy's identity from its recorded group Finding the recorded name on the group the template asks for read the destination group's own same-named policy as this resource, so a move overwrote that policy and orphaned the original. The group is recorded on the resource at create time and compared directly instead, which drops both DescribePolicies lookups. A resource provisioned before the attribute existed has no prior group and keeps the previous behaviour. |
||
|
|
cbde58f238 |
feat(cloudformation): provision AWS::ApiGateway::ApiKey (#3122)
* feat(cloudformation): provision AWS::ApiGateway::ApiKey Per-service provisioner over ApiGatewayService. Ref and Fn::GetAtt APIKeyId both yield the key id. Description, Enabled and Tags update in place. Name, Value and GenerateDistinctId are createOnly, so a change to any of them is refused as a replacement rather than applied to the existing key. A template that omits Name keeps its generated name across updates instead of minting a second key. Stack deletion deletes the key and tolerates one already gone. ApiGatewayService gains replaceApiKeyTags so an update can drop a tag the template no longer declares. Ported from lex00/floci#118. Tracked in lex00/floci#192. * fix(cloudformation): keep an API key's create-time reserved tags across updates replaceApiKeyTags checked the whole desired map against the reserved list, so a key created with a reserved floci tag could never change an ordinary tag afterwards. Only a reserved tag that is new or changed is an update-time override attempt and is refused now. Adds a test that dropping Description from the template clears it on the key. |
||
|
|
ba3dd657b6 |
feat(cloudformation): provision AWS::SNS::TopicPolicy (#3126)
Adds the type to SnsCfnProvisioner beside Topic and Subscription. A topic policy is not an entity of its own: it writes the Policy attribute of every topic the template lists, so re-applying on UpdateStack is what an update means. The document goes through resolveJsonAttribute like FilterPolicy, so a Ref to a topic inside Resource resolves to the ARN. The physical id is synthetic and stays put across updates, as AWS::SQS::QueuePolicy does, and Ref and Fn::GetAtt Id both return it. An empty Topics list or a missing PolicyDocument is refused. Delete touches nothing, as with QueuePolicy. Ported from lex00/floci#118. Tracked in lex00/floci#192. |
||
|
|
41022d09fb |
feat(cloudformation): support service-managed stacksets (#3055)
* feat(cloudformation): support service-managed stacksets * fix(cloudformation): restrict service-managed account targeting * docs(cloudformation): sync resource type table * fix(cloudformation): align service-managed stackset contracts * test(cloudformation): isolate stackset organization fixture * fix(cloudformation): preserve stackset update handling after rebase * fix(cloudformation): preserve stackset OU deletion targets * fix(cloudformation): preserve overlapping stackset targets * fix(cloudformation): reconcile stackset deployment targets |
||
|
|
dec348d382 |
feat(iot): provision AWS::IoT::Thing, Policy and TopicRule (#3014)
* feat(iot): provision AWS::IoT::Thing, Policy and TopicRule CloudFormation now creates, updates and deletes things, policies and topic rules through the existing IoT operations. Ref returns the name; Fn::GetAtt returns the thing ARN and id, the policy ARN and id (the name, as on AWS) and the rule ARN. Attribute payloads are replaced in place, a changed policy document becomes a new default version, a rule is replaced in place, and a rename replaces the entity. The topic rule payload is handed to the service in the API's own shape. A policy is detached from its principals before it is deleted. * test(iot): keep policy variables verbatim in a stack-created policy * fix(iot): cap a policy at five versions and prune the oldest on a stack update CreatePolicyVersion refuses a sixth version with VersionsLimitExceededException (HTTP 409), as AWS does, and every policy version write runs under one lock so racing creates cannot slip past the check. A stack update with a changed document now does what the AWS CloudFormation handler does when the service refuses: it deletes the oldest version, after moving the default to the newest when the oldest is the default, and creates the new version again. Before this change the versions of a policy updated by a stack piled up without limit. * fix(iot): keep pruning when another version fills the slot before the retry The prune and the retry are separate calls, so another client could create a version between them and the single retry failed the stack update. The provisioner now prunes and tries again, up to as many times as a policy has versions, before it gives up. * fix(iot): delete the oldest policy version in one step under the version lock A stack update pruning a full policy selected the oldest version, moved the default and deleted it in separate service calls, so a direct client could delete or promote that version in between and the stale delete failed the update. The selection, the default move and the delete are now one step in IotService under the version lock; the provisioner only asks for it and retries. * fix(iot): make room for a policy version in one step and lock the policy delete A policy persisted before the cap can hold more than five versions, and the one-version prune then needed one failed stack update per four surplus versions. The service now deletes the oldest versions until one more fits, in one step under the lock, and the provisioner asks for that. DeletePolicy takes the same lock: a version created in the middle of a delete used to put the policy back after the delete had returned. The limit error now carries the message AWS sends, and the tolerated limit error is logged at debug level. * docs(cloudformation): regenerate the resource-type table after the rebase onto main |
||
|
|
c3d977a3e3 |
feat(apigateway): provision AWS::ApiGateway::DomainName and BasePathMapping (#3040)
* feat(apigateway): provision AWS::ApiGateway::DomainName and BasePathMapping Both types were stubs: the stack turned green while no domain or mapping existed, Fn::GetAtt on the domain resolved to the literal attribute name, and a request sent to the custom domain was not routed. The new provisioner calls the existing CreateDomainName and CreateBasePathMapping. Ref and every Fn::GetAtt attribute return what GetDomainName reports, a changed DomainName or BasePath replaces the resource (created before the prior one is deleted), and everything else is patched in place. The physical id of a mapping is the compound identifier CloudFormation uses for the type, <DomainName>|<BasePath>, with (none) for an empty base path. Service fixes needed so the provisioned values can be read back through the API: CreateDomainName keeps regionalCertificateArn and regionalCertificateName (both were dropped), an EDGE domain gets a distributionDomainName and the fixed CloudFront hosted zone, GetDomainName returns domainNameArn, endpointConfiguration.types and tags, UpdateDomainName accepts the /endpointConfiguration/types/EDGE patch path, domain tags are managed through the tag API on the domain ARN, and CreateDomainName checks the name and stores the domain under one lock so two concurrent creates cannot both succeed. * fix(apigateway): keep the distribution in step with a domain's endpoint type A move to EDGE through UpdateDomainName left the domain without a distributionDomainName, and a move back to REGIONAL kept the old one, so GetDomainName and Fn::GetAtt reported CloudFront fields that did not match the endpoint type. Both create and update now go through one helper that puts a distribution in front of an EDGE domain and drops it for a REGIONAL one. * fix(apigateway): serialize domain and mapping changes, refuse a taken base path, validate the endpoint patch path The stores hand out live objects, so a domain patch, a tag write and a mapping patch were read-modify-write steps that concurrent calls could lose or corrupt: eight concurrent tag writes on one domain kept four tags. Every change to a custom domain or a base path mapping now runs under one lock, and a tag write replaces the tag map instead of changing the one a reader may be iterating. CreateBasePathMapping on a base path that already has a mapping answers ConflictException as AWS does; before, the new mapping silently replaced the old one, so eight concurrent creates of one base path all succeeded. UpdateDomainName accepted any /endpointConfiguration/types/<x> path; the path must now name the type the domain has, as on AWS. The provisioner sends the PATCH before it reconciles the tags, so a rejected update leaves the tags as they were. Tests cover every case above, the remaining cells of the update matrix (a prior resource gone under a new name), and the REGIONAL to EDGE move end to end through a stack. * fix(apigateway): refuse an endpoint type other than REGIONAL or EDGE on CreateDomainName UpdateDomainName already rejected any other value, but CreateDomainName stored whatever string the request carried, so a PRIVATE or misspelled type produced a domain that was neither regional nor edge-optimized and that nothing could route or describe. Private custom domains are not emulated, so the create now answers BadRequestException with the same message as the update, and nothing is stored. Adds the two remaining provisioner matrix cells as tests: a taken domain name fails the resource without deleting anything, and a resource without Properties is rejected. |
||
|
|
3600038a3f |
fix(ssm): set the Arn attribute on AWS::SSM::Parameter (#3019)
The registry schema lists Arn as the type's only read-only property, but the provisioner never set it, so Fn::GetAtt [Param, Arn] resolved to the literal "Param.Arn" and CfnSchemaCoverageTest fails on main once the schema corpus is present. The ARN uses AWS's parameter/<name> form: a name without a leading slash gets one inserted, a name with one is not doubled. |
||
|
|
9220c057b7 |
feat(iot): domain configurations (#3008)
* feat(iot): add the domain configuration model and service Stores AWS IoT Core domain configurations the way the API reports them: a new configuration is ENABLED and CUSTOMER_MANAGED (ENDPOINT without a domain name), carries one VALID server certificate, the default TLS policy and an ARN with the short id AWS appends. Update changes the status, authorizer, TLS, certificate and protocol settings; delete refuses an ENABLED configuration, as AWS does; list filters by service type and pages with marker and pageSize. Tags work on the ARN. * feat(iot): serve the domain configuration API Adds the REST-JSON routes CreateDomainConfiguration, DescribeDomainConfiguration, UpdateDomainConfiguration, DeleteDomainConfiguration and ListDomainConfigurations under /domainConfigurations, registered with the IoT service so the X-Amzn-Errortype header is set for unsigned callers too. Tags on a configuration ARN go through IotTagHandler; the IoT /untag route now uses the same handler as /tags instead of calling IotService directly. DescribeEndpoint accepts iot:CredentialProvider, the endpoint type that pairs with the CREDENTIAL_PROVIDER service type. * feat(iot): provision AWS::IoT::DomainConfiguration Adds IotDomainConfigurationCfnProvisioner over the domain configuration service. Ref is the configuration name; Fn::GetAtt Arn, DomainType and ServerCertificates resolve to what DescribeDomainConfiguration reports (ServerCertificates as a JSON string, since attributes are strings). Like the CloudFormation handler, a configuration is created ENABLED and a DomainConfigurationStatus of DISABLED is applied with a follow-up update; tags go through TagResource and are reconciled on update; a delete disables the configuration first because the API refuses to delete an ENABLED one. UpdateStack keeps the configuration when the createOnly properties (DomainName, ServiceType, ValidationCertificateArn, ServerCertificateArns) are unchanged and replaces it otherwise, with a fresh generated name when the template names none. Inventory TSV, fixture wiring and the generated resource-type table updated. * docs(iot): describe domain configurations and add the stack integration test IotDomainConfigurationCfnIntegrationTest provisions the type through a stack and asserts Ref and every Fn::GetAtt attribute against DescribeDomainConfiguration, the in-place status update, and that DeleteStack removes the configuration. * test(iot): cover domain configurations in the Java and Go SDK suites Both cases create, describe, list, update and delete a configuration through the real SDK clients and check the AWS error types on the duplicate create, the refused delete of an ENABLED configuration and the describe after deletion. * fix(iot): remove a renamed domain configuration and keep the status when the template omits it A template that changes DomainConfigurationName creates the new configuration and now removes the previous one, as the generated-name replacement already did; before, the old configuration outlived the stack. An update without DomainConfigurationStatus no longer forces ENABLED: the field is omitted and the current status stays, as the AWS handler does. The service rejects a structured JSON value where a string, boolean, list or object is expected instead of turning it into an empty string or silently clearing the authorizer, and validates the whole update before touching the stored record. * fix(iot): let stack rollback remove a domain configuration and make same-name creates atomic A configuration created by a stack is recorded, with the owned marker, before the follow-up status update, so a failure there still lets the create rollback delete it. A replacement that fails after the new configuration exists removes it again, re-enables the previous one if it had been disabled on the way out, and marks the resource restored, as the other provisioners do. CreateDomainConfiguration checks and stores the name in one step, so two overlapping creates of the same name cannot both succeed. A tags value that is not a list is rejected. The Java SDK compatibility case looks for a leftover configuration instead of swallowing every cleanup exception. * fix(iot): point the resource back at the prior domain configuration after a failed replacement After the unwind removes the replacement and re-enables the previous configuration, the resource now carries the previous name and attributes again, without the owned marker, so it describes the configuration that is still there rather than the one just removed. * feat(iot): serve the AWS-managed domain configurations Every AWS account has iot:Data-ATS, iot:Data, iot:CredentialProvider and iot:Jobs without creating them. They now exist in every region on first use: AWS_MANAGED, ENABLED, no server certificate, and the address DescribeEndpoint returns as their domain name. They can be updated and tagged like any other configuration, but not deleted, as on AWS. A client that starts by describing iot:Data-ATS gets an answer instead of a 404. * fix(iot): report a failed replacement cleanup as a rollback failure When the unwind of a failed replacement cannot remove the new domain configuration, the resource now carries the rollback-failure marker with the reason, so the stack ends in UPDATE_ROLLBACK_FAILED instead of reporting a clean rollback while the configuration is still there. The marker moves next to the restored one in CfnRollback so extracted provisioners can set it; the legacy provisioner keeps its alias. * fix(iot): serialise every read-modify-write on a domain configuration Update, delete, tag and untag read a record, change it and write it back. Two overlapping writers lost each other's changes: sixteen tag writers on one configuration left seven keys. All of them now run under the lock the create already used, and a test pins the invariant. A JSON round trip with the mapper setup persistent storage uses pins that the model reloads intact. * fix(iot): keep the prior status the unwind compares against and never delete a same-name replacement The store hands out its live record, so disabling the prior on the way to deleting it changed the very object the unwind later compared against, and a prior whose delete failed half way was left DISABLED while the stack reported a clean rollback. The status seen at the start is now kept and used. The test reproduces the aliasing instead of handing the provisioner a fresh copy per call. A replacement under the same explicit name normally fails on the create; if it goes through because the prior vanished in between, the prior is no longer deleted, which would have removed the configuration just created. * fix(iot): tolerate a domain configuration that vanishes while a stack delete disables it The disable that precedes the delete now treats ResourceNotFoundException as already deleted, the way the delete itself does. The SDK cases also enable an already ENABLED configuration, the call a client makes when it only wants to be sure the configuration is on. |
||
|
|
f3c251ef20 |
feat(cognito): provision AWS::Cognito::UserPoolDomain (#3005)
* feat(cognito): provision AWS::Cognito::UserPoolDomain The type was a stub: the stack turned green, but Fn::GetAtt CloudFrontDistribution resolved to the literal LogicalId.CloudFrontDistribution, so a Route 53 alias record for a custom domain pointed at that text. CognitoCfnProvisioner creates the domain through the existing CreateUserPoolDomain. Ref is the domain name and CloudFrontDistribution is the CloudFront name DescribeUserPoolDomain reports. A changed Domain or UserPoolId replaces the domain; any other change is applied in place through the new UpdateUserPoolDomain operation, so the distribution a DNS alias points at survives a certificate change, as on AWS. Delete uses the pool id recorded at create time and tolerates an already deleted domain. UpdateUserPoolDomain is also exposed on the Cognito API, with the same response shape as CreateUserPoolDomain. * feat(cognito): treat null domain settings as absent and pin the same-name replacement failure Review follow-ups for AWS::Cognito::UserPoolDomain: - A JSON null inside CustomDomainConfig was copied as the text "null", which would have passed for a certificate ARN. Null values are now skipped, so the service rejects the missing ARN as it should. - ManagedLoginVersion on CreateUserPoolDomain and UpdateUserPoolDomain treated an explicit null as 0, overwriting the stored version. Null now counts as omitted, and a value of another JSON type is a SerializationException, as on AWS. - Moving an unchanged domain to another pool fails on the create, because domain names are unique across pools and the replacement is created before the original is deleted, exactly as on AWS. The unit test that mocked this path as a success is replaced by one that pins the failure and checks the original domain is left in place. * test(cognito): cover domain replacement, prefix domains and SecurityPolicy updates The stack test now also renames the domain through UpdateStack, asserting the old domain is gone and the new one has its own distribution, and a second stack proves a prefix domain resolves Fn::GetAtt CloudFrontDistribution to an empty string rather than the literal attribute name. The service test covers a SecurityPolicy change and that an omitted policy is kept. The in-place check reads ctx.reusesPriorEntity(domain), as the sibling provisioners do. * test(cognito): provision the stack test's certificate through AWS::CertificateManager::Certificate With the ACM provisioner merged, the stack test now declares the certificate as a resource and references it with Fn::GetAtt, the way CDK does. Rotating to a new certificate resource updates the domain in place and removes the old certificate once nothing references it. A wildcard name keeps a domain rename from replacing the certificate. |
||
|
|
38176b9e05 |
feat(acm): provision AWS::CertificateManager::Certificate (#3003)
* feat(acm): provision AWS::CertificateManager::Certificate Adds AcmCfnProvisioner over the existing AcmService. Ref and Fn::GetAtt CertificateArn both resolve to the certificate ARN instead of the stub's literal "LogicalId.CertificateArn". Maps DomainName, SubjectAlternativeNames, ValidationMethod (default DNS), KeyAlgorithm and Tags; DomainValidationOptions is accepted and ignored because the certificate is ISSUED at once, there is nothing to validate locally. UpdateStack: a change to a createOnly property (DomainName, SubjectAlternativeNames, KeyAlgorithm) requests a new certificate and deletes the previous one; otherwise tags are reconciled in place. Delete tolerates an already removed certificate and lets ResourceInUseException propagate. Tests: AcmCfnProvisionerTest (attribute keys, update paths, delete), AcmCfnIntegrationTest (stack output is an ARN DescribeCertificate finds, gone after DeleteStack). Inventory TSV, fixture wiring and the generated resource-type table updated. * fix(acm): remove the replacement certificate when the prior one cannot be deleted On a replacing update, a failure deleting the previous certificate (ResourceInUseException, for one) made the update fail after the new certificate existed. CloudFormationService restores the previous StackResource on a failed update and never learns the new ARN, which orphaned that certificate. Delete it and mark the resource restored for the rollback walker, as Route53CfnProvisioner does for zones. Also pins that a ValidationMethod-only update keeps the certificate: the property is writeOnly in the registry schema and "No interruption" in the AWS docs, and ACM has no call to change it on an issued certificate. |
||
|
|
eb0472fccc |
docs: fix stale image tags, release model, service nav and contributor checklists (#2980)
The getting-started and contributor docs had drifted from what the workflows and the code actually do: - quick-start and CONTRIBUTING pointed users at a `latest-jvm` image that the release pipeline never publishes; both now name the `-compat` image, and `make docs-check` greps the docs for any `-jvm` tag - the CONTRIBUTING branching model now matches the workflows: `main` is published as the nightly channel, a maintainer runs the Release Cut workflow to tag a release, and the tag triggers the publish; PR builds produce compat images but never publish them - README and the docs landing page carried a hand-maintained service count and a second copy of the service table, both stale; they now link to the Services Overview - the Service Matrix gains the ELB Classic row it was missing, with an `elb` alias so the check no longer resolves the Classic key to the v2 page, and check_service_matrix.py now also fails on a docs/services page that has no row - the README category table lists 16 documented services it omitted - mkdocs nav gains 11 service pages that were unreachable from the site, drops a duplicate CloudTrail entry, and the docs job now runs `mkdocs build --strict` with nav and link validation so a page without a nav entry fails CI - AGENTS.md, CONTRIBUTING.md and docs/contributing.md told contributors to register a service in ServiceRegistry, which has no registration API; all three now point at ResolvedServiceCatalog and list the config, storage, native-image, docs, tooling and compat-suite touchpoints a new service needs |
||
|
|
5dc0808bda |
feat(cloudformation): report a stubbed unsupported resource type instead of hiding it (#2971)
An unsupported resource type was stubbed at debug, so the stack reached CREATE_COMPLETE and a green stack did not prove its resources existed. The stub is now reported at warn, naming the type, and the resource carries a status reason saying nothing was created, which DescribeStackEvents returns. A new floci.services.cloudformation.allow-stub-unsupported-resource-types setting (default true) turns the stub into a stack failure for suites that need a green stack to mean every resource exists. An unexpanded SAM resource type warns on its own, and the delete path names the physical id it does not remove. Closes #2967 |
||
|
|
77b4881fe4 |
fix(cloudformation): merge Fn::Transform AWS::Include before provisioning, and honour GetTemplate TemplateStage (#2886)
* test(cloudformation): pin Fn::Transform AWS::Include merging against the deployed template
The expected values come from a deployed stack's original and processed templates,
read with get-template, and from get-template-summary probes against real AWS.
Every assertion states its expected value as a literal, including the spliced
multi-line Fn::Sub value with its line breaks intact.
* fix(cloudformation): merge Fn::Transform AWS::Include before provisioning
The template engine evaluated ten intrinsics and Fn::Transform was not among them,
so an AWS::Include node was neither expanded nor rejected: it reached provisioning
as an ordinary key. A state machine whose DefinitionSubstitutions came from a
snippet therefore reached CreateStateMachine with a key literally named
Fn::Transform and without any of the snippet's keys, leaving every ${placeholder}
unsubstituted in the stored definition. The stack still reported CREATE_COMPLETE.
Measured against a deployed stack: 41 Fn::Transform nodes in the original template,
all Name AWS::Include, all with the same s3:// Location, all at
Resources.<id>.Properties.DefinitionSubstitutions; 0 in the processed template. At
one of those positions the six sibling keys keep their original order and the five
snippet keys are appended after them, and the spliced multi-line Fn::Sub value keeps
its line breaks: nothing is folded or re-serialized.
Three controlled get-template-summary probes settle the summary contract. A template
with no transform reports DeclaredTransforms null and its ResourceTypes; the same
template with an embedded Fn::Transform, and one with a top-level Transform, both
report DeclaredTransforms AWS::Include. GetTemplate keeps returning the body as
submitted, matching AWS's TemplateStage=Original default, while the change-set
baseline uses the merged body so a byte-identical resubmission reports no change.
* test(cloudformation): pin Fn::Transform AWS::Include rejection when Parameters is absent entirely
* test(cloudformation): pin Fn::Transform AWS::Include rejection when Location is present but blank
* fix(cloudformation): name the Fn::Transform node when AWS::Include Parameters is absent or Location is blank
* test(cfn-transform): pin AWS::Include Location error message for blank and null-Parameters shapes
Renames the existing empty-string test to name the shape it actually feeds,
adds coverage for a whitespace-only Location (which today leaks its raw
value with no quoting) and for an explicit null Parameters (which already
renders the Fn::Transform node, with no test pinning that literal).
* fix(cfn-transform): reject whitespace-only Location and stop leaking non-object Parameters
describeLocation checked isEmpty() where its own javadoc promised blank, so a
whitespace-only Location leaked its raw unquoted value into the rejection
message instead of a quoted string. It also enumerated missing and null as
the only non-mapping Parameters shapes, so a scalar or a list Parameters fell
through to Location's MissingNode and the message rendered Parameters itself
as if it were the rejected Location. Both guards now ask a single question
each: isBlank() for the Location text, and isObject() for the Parameters
shape, dropping the OR out of the second guard.
* test(cfn-transform): pin AWS::Include Location error message for scalar and list Parameters
Closes the coverage gap for defect 2: before the isObject() guard, a scalar
or list Parameters fell through to Location's MissingNode and the rejection
message rendered Parameters itself as if it were the Location, which a
reader could mistake for a valid rejected URI. Both templates go red against
the pre-hunk isMissingNode()||isNull() guard and green against isObject().
* test(cloudformation): pin GetTemplate TemplateStage selecting Processed vs Original
Processed must return the SAM-expanded, AWS::Include-merged body with no
AWS::Serverless::Function or Fn::Transform node left; Original and the
no-stage default must return the caller's raw YAML byte for byte; an
invalid stage must reject with the AWS enum ValidationError; and a plain
stack with no transform must return identical bodies for both stages and
advertise StagesAvailable on every GetTemplate call.
* fix(cloudformation): honor GetTemplate TemplateStage instead of always returning Original
GetTemplate accepted no TemplateStage, so a caller asking for Processed was
silently answered with Original. It now validates the parameter against
AWS's Original/Processed enum, returns stack.templateBody (the SAM- and
AWS::Include-merged body) for Processed and stack.originalTemplateBody
(the caller's raw submission, also the default) otherwise, and reports
StagesAvailable on every response, matching real AWS.
* test(cloudformation): pin GetTemplate TemplateStage validation ordering and empty-string rejection
Pins two AWS-measured behaviors GetTemplate does not have yet: TemplateStage
Bogus is rejected with the enum ValidationError even when the named stack was
never created, proving AWS validates the request shape before the stack
lookup; and TemplateStage="" (present but empty) is rejected the same as any
other value outside the enum, distinct from the omitted case which defaults
to Original.
* fix(cloudformation): validate GetTemplate TemplateStage before the stack lookup and reject an empty value
Two ordering and parsing gaps measured against a real account: an invalid
TemplateStage was rejected with "Stack ... does not exist" instead of the
enum ValidationError when the stack was absent, because the lookup ran
first; and TemplateStage="" (present but empty) was silently accepted as
Original instead of rejected, because isBlank() treated it the same as the
omitted case. Both are hoisted/tightened to match AWS. The two stage names
are also named once as constants instead of retyped across the enum list,
the StagesAvailable list, the stage-selection check and the default, and the
rollback comment and docs are rewritten to describe today's two-stage
behavior instead of the pre-TemplateStage one.
* docs(cloudformation): correct GetTemplate Processed-stage claim, drop a self-evident comment
The GetTemplate doc claimed AWS::LanguageExtensions, a third-party macro, and the
top-level Transform AWS::Include short form always leave Processed unexpanded.
SamTransformProcessor removes the whole Transform section unconditionally when the
template also declares the SAM transform, so any of those three shapes co-declared
with SAM is gone from Processed too; the sentence now states that condition.
Also drops the block comment above STAGE_PROCESSED/STAGE_ORIGINAL: it restated what
the constant names already show.
* docs(cloudformation): drop the CAPABILITY_AUTO_EXPAND deviation, measured as parity
A CreateChangeSet carrying an embedded Fn::Transform/AWS::Include was
accepted against a real account with CAPABILITY_IAM alone, so requiring
no capability for AWS::Include matches AWS rather than deviating from
it. The known-deviation count drops from three to two, and the
unmeasured CreateStack path is named as unmeasured.
---------
Co-authored-by: Facundo Paredes <25681464+facuparedes@users.noreply.github.com>
|
||
|
|
961d82dda9 | fix(cloudformation): provision AWS::Scheduler::ScheduleGroup (#2796) | ||
|
|
b76eadc98e |
docs(cloudformation): generate the supported resource-type table (#2739)
The "Supported Resource Types" table was hand-maintained, and had drifted: ten provisioned types were undocumented, including the whole CloudFront row, Lambda's Permission/MicrovmImage/NetworkConnector, RDS DBProxy and DBProxyTargetGroup, ECS capacity providers, EC2 VPCEndpoint and ApiGatewayV2 Authorizer. Generate it from the provisioner inventory TSV that CfnResourceInventoryTest already pins to the CDI-resolved registry, so the table cannot drift from what Floci actually provisions. Wired into docs-sync and docs-check, with the inventory path added to the workflow filters: it lives under src/test/resources, which src/main/** did not cover, so a slice that moved a type between owners would have skipped the gate. The table is prose as much as data, so presentation stays configurable in cfn_resource_types.yaml: service labels, curated type order (types not listed there are appended alphabetically, so a new type still appears), per-type notes, and extra_types for capabilities that are real but are not provisioner types, each needing a stated reason. Nested Stack and the Custom::* wildcard are the two such entries; the wildcard cannot be an inventory type because the registry is keyed by exact type. The generator reads the TSV rather than the Java because several provisioners return Set.of(CONSTANT, CONSTANT) from resourceTypes(), which a source regex only partly sees. Also flags two things cheaply, before anyone waits on a Quarkus boot: a provisioner missing @ApplicationScoped, and a type claimed by both the legacy switch and a provisioner. |
||
|
|
8a705d0aae |
feat(cloudformation): provision WAFv2 web ACLs and AWS Config rules (#2701)
* feat: provision WAFv2 web ACLs
* feat: provision AWS Config rules
* fix: adapt provisioners to current 3-arg CfnResourceProvisioner.delete()
* fix: preserve new-resource tracking when replacement cleanup fails, and stop dropping inline-object InputParameters
Local code review (review-local.ts) flagged two ordering bugs on the replacement
path in both provisioners: the new resource's physicalId/attributes were only
recorded after the old resource's delete call succeeded, so a delete failure
(e.g. WAFAssociatedItemException, or a Config rule still referenced elsewhere)
left the stack tracking the old resource while the newly created one leaked
untracked. Both now record the new resource first and treat old-resource
cleanup failure as non-fatal, matching the existing precedent in
Ec2LaunchTemplateCfnProvisioner.
Also fixed AWS::Config::ConfigRule.InputParameters being silently dropped
when a template supplies it as an inline JSON object (the common case) rather
than a pre-stringified JSON string: JsonNode.asText() returns empty string
for object nodes.
* fix(cloudformation): preserve intrinsic-resolved JSON fields on WAFv2 WebACL, log tolerated replacement-cleanup failures, add GetAtt coverage
raw() in WafV2CfnProvisioner used JsonNode#isEmpty(), which is true for every
scalar node, so any field CloudFormationTemplateEngine#resolveNode collapsed
into a TextNode (e.g. an Fn::Join-built DefaultAction) silently became null
instead of the literal JSON text. Mirror ConfigCfnProvisioner's existing
isTextual()-aware handling.
Also log (previously fully swallowed) exceptions when replacement cleanup of
the superseded WAFv2 WebACL or Config rule fails, so a leaked old resource is
diagnosable, and add an integration test asserting the exact Fn::GetAtt keys
for both provisioners resolve through CloudFormation to the real resource.
Config's PutConfigRule call being unconditional on every provision is correct
AWS upsert semantics ("Adds or updates" per the Config API), not a missing
create/update branch.
|
||
|
|
08e532ab1a |
feat(cloudformation): CDK Provider-framework custom resources and changeset/SSM param fidelity (#2688)
* feat(cloudformation): changeset diffs, stack params, SSM attributes CDK's deploy loop reads all three: DescribeChangeSet now returns computed Add/Modify/Remove resource changes instead of an empty list (an empty list makes CDK skip ExecuteChangeSet on updates), DescribeStacks echoes the stack's merged parameters, and AWS::SSM::Parameter resources expose Value/Type/Name attributes so Fn::GetAtt resolves the bootstrap version (cherry picked from commit 80ac80063e84ef1be977fe625334e722cc1ed8bb) * feat(cloudformation): resolve SSM-typed stack parameters AWS::SSM::Parameter::Value<String> template parameters resolve through SSM for the stack's account and region; missing parameters fail with the real ValidationError message. Landing Zone Accelerator's security and logging stacks depend on this typed-parameter resolution. The IAM password-policy and S3 replication-config changes from the same source commit ship separately in the iam and s3 branches. (cherry picked from commit 10dbabbf5e31d763a398fc1fff16ab0484958af0) * feat(cloudformation): drive CDK Provider framework custom resources The CDK Provider framework defers its ResponseURL callback to a Step Functions waiter that polls framework.isComplete on a Retry cadence until the resource is ready. The custom-resource provisioner only waited the synchronous single-lambda budget for a ResponseURL PUT, so the waiter-driven PUT never landed. A framework.onEvent ServiceToken is now awaited on a bounded async budget so that PUT is captured; onEvent-only and single-lambda resources are unchanged. The engine-side half of the original commit -- a Task-only Retry implementation for the ASL executor (ErrorEquals/IntervalSeconds/ MaxAttempts/BackoffRate/MaxDelaySeconds) -- is dropped here: upstream #2455 ("feat(sfn): support Retry policies in Task, Parallel, and Map states") landed a broader Retry implementation independently (Task, Parallel, and Map states; JitterStrategy; $$.State.RetryCount; Retry-before-Catch ordering), a strict superset of what this commit needed. The full stepfunctions suite (411 tests) is green against it on this branch, and CustomResourceProviderFrameworkTest (a hermetic test of the provisioner's own detect-and-wait logic, no Step Functions involved) is unaffected by the drop. (cherry picked from commit 5b3502d8c9dddf3766ca3f94fe7f146042dc00fd) * docs(cloudformation): document CDK provisioning Documents the CDK Provider-framework custom-resource support and folds its cross-reference into upstream's existing "Retry policies" section in step-functions.md rather than duplicating it with a separate "State Retry" section (upstream #2455 already documents the Retry engine itself). * feat(cloudformation): budget custom-resource waits by idleness, not total time The async custom-resource wait was a fixed 3-minute total budget. That is a property of the emulator, but the time a CDK provider-framework resource needs is a property of the work: Custom::CreateOrganizationAccounts creates exactly one account per 15s waiter poll, so a 3-account org finishes in ~45s while a 15-account org needs ~195s. Past the budget the Lambda is guillotined mid- success -- the accounts all exist, but the resource reports CREATE_FAILED, the stack rolls back, and CDK's readback then surfaces the misleading "NoStack: CloudFormationStack object does not hold a stack". Measure idleness instead. The provisioner already embeds its callback token in the ResponseURL it puts on every event, and the framework echoes that event into each framework.isComplete poll, so a poll arriving at LambdaService is proof of progress for a specific pending resource. Each poll resets the budget, which makes the wait proportional to the work without CloudFormation needing to know what the work is -- and a genuinely hung resource still fails after 3 idle minutes exactly as before. CustomResourceLiveness lives in core.common so the Lambda service can report progress without depending on CloudFormation; the dependency already runs the other way. (cherry picked from commit 14087c992ebb75d109999153a9e8af7e3c2d79f4) (cherry picked from commit 51349e4e017ed08d90e6e71212414e2f306c826b) * fix(cloudformation): call the caller-scoped getStackOrThrow overload that exists The changeset-diff commit re-derived onto main carried a call to a three-arg getStackOrThrow(name, region, accountId) overload that only existed on the account-scoping commit deliberately skipped as superseded by upstream. Upstream's resolveStack already scopes to the caller's account, so the two-arg form is equivalent and compiles. * fix(cloudformation): honour an arrived custom-resource response past its budget A synchronous custom-resource handler PUTs to the ResponseURL from inside the invoke the provisioner is blocked on, so its response can already be delivered by the time await() is entered. Two independent flaws then threw it away. The idle clock started at register(), before the invoke. A provider-framework onEvent-only handler that took 75s to return -- two nested cold container starts -- had spent its 10s CR_RESPONSE_TIMEOUT six times over before await was reached, so the very first deadline check was already negative. Idleness of the wait cannot include time the handler spent working; the clock now starts when the caller starts waiting. The deadline guard also threw without ever consulting the future, so a response that had completed it was discarded as a timeout. Observed on AccessAnalyzerServiceLinkedRoleCreateServiceLinkedRoleResource: the handler logged its response at 15:52:11.768 and the resource was failed 24ms later. An arrived response outranks the clock. Both are pinned by red-first tests. The existing idle-timeout guarantees are unchanged: nothing arriving still times out, and a resource that stops reporting liveness still dies on schedule from its last touch. (cherry picked from commit 7dc8bbca7d47b2a029b5656a89421a556b8296be) (cherry picked from commit 77b71b31a634ae27d7460a078b52dac250d67dc7) * refactor(cloudformation): extract Provider-framework detection from the provisioner The CDK Provider-framework `framework.onEvent` detection and the longer idle budget it earns lived in CloudFormationResourceProvisioner, adding ~55 lines to a class that is being dismantled rather than grown. Move the concern to ProviderFrameworkDetector: it owns the two waiter marker env vars, the best-effort environment probe, the 3-minute async budget and the test seam that shortens it. CustomResourceResponseStore — which already owns the idle-timeout concept via touch/await — gains an await overload that resolves the budget for a ServiceToken and delegates to the existing one, so the provisioner only passes the token through and appends the store's timeout detail to its error. Behaviour is unchanged. (cherry picked from commit 5f93439f409a32012a01b996c5edd0c29d23b260) * fix(stepfunctions): report custom-resource liveness on waiter polls A CDK provider-framework waiter's framework.isComplete poll is itself a Lambda Task the state machine invokes, so it goes through AslExecutor.invokeResource -> LambdaExecutorService directly, bypassing LambdaService.invoke() and the liveness hook it carries. A long-but- progressing custom resource's idle budget in CustomResourceResponseStore ticked down as if no polls were arriving, even while they kept landing. AslExecutor now reports liveness the same way LambdaService does: extract the callback token from the invoke payload and touch() it before invoking. * perf(core): avoid materializing the full payload string in tokenIn CustomResourceLiveness.tokenIn() ran on every Lambda invoke once liveness reporting is wired in, decoding the whole invoke payload as a UTF-8 String even though the overwhelming majority of invokes carry no callback URL at all. Scan the raw bytes for the ASCII "/cfn-response/" marker instead, and only allocate a String for the small token substring when one is found. * fix(cloudformation): compute accurate changeset resource diffs computeChangeSetChanges never read cs.getParameters(), so an update that only changed parameter values reported an empty diff and CDK skipped execution, leaving the old parameter-derived config deployed. It also diffed a SAM change set's raw template against the stack's expanded deployed template, reporting spurious Modify/Remove on every SAM-generated resource for a no-op update, and hardcoded Replacement=False even when a resource's Type changed. Now the diff expands a SAM change set's template before comparing, marks a resource Modify when it references a changed parameter, and reports Replacement=True when a resource's Type changes. * fix(cloudformation): restore last-successful parameters on update rollback executeTemplate overwrote the stack's live parameter map with an update's attempted values before resolving SSM-typed parameters, which can fail. A failed resolution rolled the stack back, but the update snapshot never captured parameters, so DescribeStacks reported the failed update's attempted values instead of the last successfully deployed ones. StackUpdateSnapshot now captures the stack's parameters alongside its template body, and rollbackFailedUpdate restores them together. * fix(cloudformation): log tolerated wait-slice timeouts in custom-resource poll loop Each slice of the custom-resource poll loop below the outer idle budget hit an intentionally-tolerated TimeoutException that was swallowed with only a comment, against the repo's convention of logging deliberately caught exceptions. * fix(cloudformation): honor Parameters.member.N.UsePreviousValue extractParameters never read UsePreviousValue, so submitting it without a ParameterValue stored an empty string for that key. The new parameter-diff logic in computeChangeSetChanges ( |
||
|
|
ac94232910 |
feat(cloudformation): CodeBuild/CodePipeline CFN provisioning (#2685)
* feat(cloudformation): provision CodePipeline pipelines and actions New CodePipelineCfnProvisioner handles AWS::CodePipeline::Pipeline, AWS::CodePipeline::CustomActionType, and AWS::CodePipeline::Webhook by lowering the PascalCase CloudFormation properties into the camelCase CodePipeline API shapes and delegating to the service, so stacks and the API produce identical pipelines. Ref resolves to the pipeline name (generated CloudFormation-style when Name is omitted), Fn::GetAtt Version and webhook Url are populated, an existing physical ID routes updates through UpdatePipeline instead of recreating, DisableInboundStageTransitions is applied after creation, and deletes tolerate already-removed resources. (cherry picked from commit 8007d0b7e872d573217309fccd756c66a2d339a4) * fix(cloudformation): bundle cfn-response into inline ZipFile Lambdas AWS injects the cfn-response (Node.js) and cfnresponse (Python) modules into functions created through CloudFormation's inline ZipFile property, and custom-resource handlers across AWS Solutions templates rely on that — Landing Zone Accelerator's installer stack fails its very first Custom::CreateUUID resource with 'Cannot find module cfn-response' without it. The bundled modules follow the documented AWS implementations but pick the transport and port from the ResponseURL instead of hardcoding https:443, because Floci's custom-resource callback URL is plain http on the emulator's port. (cherry picked from commit 7028f5a85daba6ba9d83032dc940cebe45c0b348) * refactor(cloudformation): extract inline ZipFile packaging CloudFormationResourceProvisioner is a monolith being dismantled, so the cfn-response bundling added there moves to its own InlineZipPackager, ready to travel with the eventual Lambda provisioner extraction. No behavior change. (cherry picked from commit d0d4bff84bda9c143606a8922500515dbe5bc0c0) * fix(cloudformation): keep CodePipeline action config keys verbatim Action and rule configuration maps carry provider-defined string keys (Owner, Repo, ProjectName, ...) that executors match exactly; the PascalCase-to-camelCase property transform was rewriting them, so CloudFormation-created pipelines could never run their GitHub source or CodeBuild actions. Configuration subtrees now pass through untouched. (cherry picked from commit 213e33d9f005ee4df6a66272a91f47ac67a3b7a3) * feat(cloudformation): provision CodeBuild projects AWS::CodeBuild::Project was falling through to the stub path, so CloudFormation-created pipelines referenced build projects that did not exist — Landing Zone Accelerator's installer pipeline failed its Install stage with 'Project not found'. The new provisioner lowers the PascalCase properties into the CodeBuild API shape (including the irregular all-lowercase buildspec field), supports update-in-place, and exposes Ref as the project name and Fn::GetAtt Arn. (cherry picked from commit 7d616b87c7fa58693537dfe7d9d86cd63437ea75) * fix(codepipeline): correct three CFN provisioning bugs in CodePipelineCfnProvisioner - DisableInboundStageTransitions is a declarative list: a stage removed from it on update must be re-enabled, not left disabled after UPDATE_COMPLETE. - CustomActionType has no update operation; a change to Category/Provider/Version is a replacement (create the new identity, delete the superseded one) rather than a silent physicalId swap with no corresponding service call. - Webhook's RegisterWithThirdParty must be read from the resolved/lowercased node, not the raw unresolved props, so intrinsics (Ref, Fn::If) are honored. * fix(codebuild): convert the JSON handler's Map entity instead of dropping it CodeBuildJsonHandler.handle(...) returns Response.ok(Map.of(...)), never a JsonNode, so the instanceof check in CodeBuildCfnProvisioner.handle always missed and silently fell back to an empty ObjectNode -- forcing the guessed ARN fallback even when the handler returned the real project ARN. Convert non-JsonNode entities with ObjectMapper.valueToTree, and close the Response. * fix(cloudformation): UTF-8 encode the injected Python cfn-response callback body http.client encodes a str request body as latin-1, raising UnicodeEncodeError for any response Reason/Data containing non-Latin-1 characters and failing the callback before it's sent. Encode the JSON body to UTF-8 bytes first. * docs(cloudformation): merge the duplicate Lambda resource-type row Two Lambda rows in the supported-resource-types table gave inconsistent descriptions (one had Version/Alias, the other the cfn-response detail). Consolidate into a single row. * fix(codepipeline): fix stage-transition and rename bugs found in re-review - Only re-enable stage transitions this stack previously disabled (tracked via a new __FlociCodePipelineDisabledStages attribute); a stage disabled externally (a manual gate, a human) and never listed in DisableInboundStageTransitions is no longer touched by an unrelated update. - Pipeline Name has no rename operation in CodePipeline; a template Name that differs from the tracked physical ID is now treated as a replacement (create under the new name, delete the old one) instead of calling UpdatePipeline against a pipeline that doesn't exist or belongs to someone else. - Webhook Name rename now deletes the previously-owned webhook after PutWebhook upserts under the new name, instead of orphaning it. * fix(codepipeline): handle legacy stage tracking and failed-replacement cleanup - A resource stored before __FlociCodePipelineDisabledStages existed has no tracking record; fall back to reconciling every declared stage on its first post-upgrade update instead of skipping reconciliation and leaving a removed entry disabled forever. - If stage-transition reconciliation fails after a rename's replacement (or a fresh create) already succeeded, best-effort delete the just-created pipeline before rethrowing. CloudFormation reverts this resource to its previous physicalId on a failed update, so without this the new pipeline is orphaned and a corrected retry hits PipelineNameInUseException. |
||
|
|
054508df87 |
feat(organizations): add CloudFormation resource types (#2495)
* feat(organizations): add CloudFormation resource types Adds OrganizationsCfnProvisioner covering AWS::Organizations::Organization, OrganizationalUnit, Account, Policy and ResourcePolicy. Attribute names are taken from the registry schemas' readOnlyProperties so Fn::GetAtt resolves the keys AWS publishes. CloudFormation's delete path hands over a physical id and a region but no caller identity, and every Organizations mutation is management-account scoped. Rather than injecting a second collaborator into the provisioner, OrganizationsService gains findManagementAccountForResource, which recovers the owning account from the resource id — so the provisioner keeps to the one-injected-service convention the other provisioners follow. provision serves create and update: an OU is renamed in place rather than recreated (ParentId is create-only in the schema), a Policy's TargetIds are reconciled in both directions, and an Account is moved to its ParentIds entry after creation. The integration test asserts through stack Outputs backed by Fn::GetAtt: an unmapped attribute does not fail provisioning, it silently resolves to the literal "LogicalId.Attr", so asserting CREATE_COMPLETE would pass with every attribute unwired. * fix(organizations): converge CFN provisioning on partial failure and tag drops Set the physical id as soon as the create call succeeds in provisionAccount and provisionPolicy, before moveAccount and reconcileTargets respectively. Both can throw once the resource already exists — a ParentIds entry pointing at a missing OU raises DestinationParentNotFoundException, and attachPolicy can fail on a bad target — and without an id CloudFormation's rollback has nothing to call delete() with, leaving the account or policy a real member of the organization but unmanaged by the stack. Make putResourcePolicy replace its tag map rather than merge into it, so a key dropped from a template is removed on update instead of lingering. A resource policy is not a TagResource target, so resolveTagOwner rejects rp- ids and the provisioner cannot reach it through replaceTags the way the other types do; Put is the only call that can converge those tags. Supplying Tags states the full set, while omitting them leaves the existing ones untouched, matching how an absent Tags property behaves for every other Organizations type. * fix(organizations): mark created accounts and policies as rollback-owned CloudFormationService.rollbackCreatedResources deletes a CREATE_FAILED resource only when it carries both a physical id and the CfnRollback.ROLLBACK_OWNED_ATTR marker. The provisioner set the id but not the marker, so rollback walked straight past an account whose MoveAccount failed after CreateAccount had already made it a member of the organization. The account survived, the organization could not be deleted while it still contained one, and the stack reported ROLLBACK_FAILED instead of unwinding. Set the marker as soon as the create call returns, the way IamRoleCfnProvisioner does, so the create and the ownership record cannot drift apart. OrganizationsCfnRollbackIntegrationTest drives a real stack whose ParentIds names an OU that does not exist and asserts the account id reaches the stack events, that rollback emits DELETE_COMPLETE for it, and that neither the account nor the organization is left behind. * feat(organizations): map OU Path and Account State/Paths The published registry schemas declare three readOnly properties the provisioner did not map: OrganizationalUnit Path, and Account State and Paths. An unmapped key does not fail provisioning — CloudFormationTemplateEngine resolves it to the literal string "LogicalId.Attr" — so a template asking for Fn::GetAtt Dev.State silently got back "Dev.State". Path and Paths are the organization path, o-<org>/r-<root>[/ou-<ou>]*[/<id>]/, which needs a walk from the resource up to the root. OrganizationsService owns that hierarchy and already computes the chain for effective-policy merging, so it exposes it as organizationPath rather than the provisioner rebuilding it. The account path is read after the move: accounts are always created under the root, so reading it earlier would publish a path the account no longer lives at. State is the parameter AWS is retiring Status in favour of on 2026-09-09. Floci only ever puts an account in ACTIVE or PENDING_CLOSURE, both of which are also AccountState values, so the two agree; PENDING_ACTIVATION and CLOSED are phases the emulator does not model. Paths is list-typed in the schema, but an account has exactly one parent and so exactly one path, and the engine's Fn::Select splits a comma-delimited scalar back into a list, so the string-valued attribute map carries it without loss. Adding the Path lookup to provisionOrganizationalUnit opens the same window that stranded accounts before: a call that can throw once the OU is already a real member of the organization. Mark the OU stack-owned as soon as the create returns, matching the account and policy paths, so rollback can still delete it. * fix(organizations): Ref on Organization returns the management account id AWS documents Organization as the one Organizations type where bare Ref returns the management account id rather than the resource's own id; Fn::GetAtt Org.Id already returned the organization id correctly. Adds an OrgRef stack output/assertion covering the case, since the existing integration test only ever exercised Fn::GetAtt on Org. |
||
|
|
1461a10de7 |
feat(cloudformation): apply security-group rules — inline properties and standalone resources (#1993)
* feat(cloudformation): apply security-group rules — inline properties and standalone resources Inline SecurityGroupIngress/Egress on AWS::EC2::SecurityGroup were silently dropped (groups deployed with no rules), and the standalone AWS::EC2::SecurityGroupIngress/Egress resource types were unsupported. Both now map onto the existing Ec2Service authorize APIs, including CidrIp/CidrIpv6 ranges and Source/DestinationSecurityGroupId peer pairs. Rules are removed with their group, so stack delete needs no revoke. Fixes #1992 * refactor(cloudformation): move standalone security-group rules into a per-service provisioner The standalone AWS::EC2::SecurityGroupIngress and AWS::EC2::SecurityGroupEgress types move out of the CloudFormationResourceProvisioner switch and into Ec2SecurityGroupRuleCfnProvisioner, discovered through the CDI registry. The inline SecurityGroupIngress/SecurityGroupEgress properties stay with AWS::EC2::SecurityGroup, which has not been extracted yet, and call the shared rule-to-IpPermission mapping so there is one copy of it. Along with the move: - delete() revokes the rule. A standalone rule can target a group that outlives the stack, so DeleteStack and create rollback used to mark the resource gone while its permission stayed active on the group. - Update revokes the rule the previous execution created before authorizing. The authorize APIs append, so re-running a template used to duplicate an unchanged rule and orphan the permission of a changed one. - A rule's Description now reaches its ipv6 range, and DescribeSecurityGroups reports ipv6 range descriptions. - GroupName resolves to a group id instead of being passed through as one. Ec2Service.deleteSecurityGroupRule removes a rule by SecurityGroupRuleId: the rule record plus the one permission (or the one range within it) that the record describes. The existing by-permission revoke matches on protocol and ports alone, which would strip a group's unrelated rules that share them. * fix(ec2): security-group rule records carry their peer, so deletion hits the right rule Three review findings with one root cause. createRules only turned ipv4 ranges into rule records. An ipv6 range or a referenced group collapsed into a single record holding nothing but protocol and ports, so DescribeSecurityGroupRules could not report the peer, and deleting one of several rules sharing a port revoked whichever permission happened to carry no ipv4 ranges — the requested rule stayed active while an unrelated one disappeared. Records are now created per peer, as AWS does: one per ipv4 range, one per ipv6 range, one per referenced group, with the peer recorded on each. removeRecordedPermission matches on that peer and drops the enclosing permission only once nothing is left in it. A record naming no peer matches only a permission that names none either, instead of falling back to the first port match. DescribeSecurityGroupRules gained referencedGroupInfo. The CFN provisioner updated a standalone rule by revoking then authorizing, so a rejected replacement left the group with neither rule: rollback keeps the old physical id but never recreates its permission, and the stack settled as UPDATE_ROLLBACK_COMPLETE minus a valid rule. It now authorizes first and revokes the previous rule only after that succeeds. * fix(cloudformation): a security-group rule names exactly one peer CloudFormation documents exactly one source per rule, an IPv4 range, an IPv6 range, a prefix list or a security group. Floci read each peer property independently, and authorize creates a rule record per peer, so a rule naming several kept only the first record as its physical id. Delete revoked that one and the rest stayed on the group, and a replacement leaked them. Naming more than one is now a ValidationError, which covers the standalone resources and the inline SecurityGroupIngress/Egress entries through the shared mapping. Delete no longer swallows failures from deleteSecurityGroupRule. That call already returns false for a rule it has no record of and succeeds when the group is gone, so the cases the catch existed for never reached it, and what it did absorb was a real failure reported to CloudFormation as a successful delete. * fix(cloudformation): a security-group rule carries its Description to a peer group The ipv4 and ipv6 branches both put Description on the range they build, while the peer-group branch left it off the UserIdGroupPair. Ec2Service reads the description straight off the pair, so a rule declaring SourceSecurityGroupId or DestinationSecurityGroupId with a Description came back from DescribeSecurityGroupRules without it. * fix(cloudformation): a security-group rule naming no source is rejected The peer check counted sources and rejected more than one, so a rule naming none passed and sent an IpPermission with no cidr, prefix list or group on it. CloudFormation then reported the source-less rule as successfully provisioned. AWS requires exactly one, so zero is as invalid as several. * fix(cloudformation): a security-group rule can name its peer group by name The source count read SourceSecurityGroupId but not SourceSecurityGroupName, so tightening the count to exactly one rejected a template that named its peer by name. The ingress schema lists both, along with SourceSecurityGroupOwnerId for a group in another account, and neither was read. Egress has no name variant. The name is handed to Ec2Service as a name rather than resolved here. resolveGroupReferences maps it to an id on authorize before createRules records the rule, so the delete path still matches on the resolved id. Also drops a stale comment three lines above the code it contradicted, claiming UserIdGroupPair has no description field. |
||
|
|
9280369b64 |
feat(cloudformation): provision ApiGateway::Account, AutoScaling::LifecycleHook, and EC2::FlowLog (#2003)
* feat(cloudformation): provision ApiGateway::Account, AutoScaling::LifecycleHook, and EC2::FlowLog Three small provisioners over existing services: Account records metadata (physical id only), LifecycleHook maps onto AutoScalingService.putLifecycleHook, FlowLog onto FlowLogService.createFlowLog (newly injected into the provisioner). Fixes #2002 * feat(cloudformation): per-service provisioners for ApiGateway::Account, AutoScaling::LifecycleHook, and EC2::FlowLog The three resource types land in the extracted provisioner structure rather than the switch in CloudFormationResourceProvisioner, one class per service: - ApiGatewayAccountCfnProvisioner writes CloudWatchRoleArn into the API Gateway account settings, so GET /account reflects what the template asked for instead of the resource being recorded as a bare physical id. - AutoScalingLifecycleHookCfnProvisioner puts the hook on its group and removes it again when the stack is deleted. - Ec2FlowLogCfnProvisioner creates the flow log and deletes it when the stack is deleted. Both deletes close the cleanup gaps raised in review: flow logs and lifecycle hooks no longer outlive their stack. The delete path only holds a physical id, and a hook's physical id is its name, so AutoScalingService gains deleteLifecycleHookByName to find the hook whichever group owns it, including groups that outlive the stack. API Gateway has no DeleteAccount operation and its account settings are regional rather than stack-owned, so that provisioner keeps the default no-op delete. CloudFormationResourceProvisioner is byte-identical to main again: no switch arms, no FlowLogService injection, and the two constructor-arg test edits are reverted. Tests: three isolated provisioner unit tests (one mocked service each) plus the integration test, extended to cover deletion of the hook and the flow log against a group created outside the stack. * fix(cloudformation): delete a lifecycle hook on its own group, not by name alone A lifecycle hook name is unique within an Auto Scaling group, not within a region, but the CloudFormation delete path only had the physical id — the hook name — so it removed every hook with that name in the region. Two groups using the same hook name meant deleting or rolling back either stack stopped the other group's lifecycle action. CfnResourceProvisioner gained a delete overload that receives the whole StackResource, defaulting to the existing id-only form, and the dispatcher calls it for extracted provisioners. It sits after the EKS Nodegroup and IAM policy special cases so extracting one of those later cannot bypass them. The hook provisioner records its AutoScalingGroupName at create time and deletes through the group-scoped API. Resources provisioned before that still fall back to the by-name form: leaving the hook behind is worse, since it can sit on a group that outlives the stack. * fix(cloudformation): a stack update reuses its flow log and lifecycle hook Ec2FlowLogCfnProvisioner called createFlowLog unconditionally, so every UpdateStack created a second flow log and orphaned the first. The orphan then outlived the stack, since delete only knows the id recorded last. It now reuses the log this stack already made and creates only when that one is absent, on a first execution or after removal out of band. AutoScalingLifecycleHookCfnProvisioner had the same shape, but only when LifecycleHookName is omitted: a freshly generated name each update left the previous hook on the group, still firing, with nothing referencing it. An unnamed hook now keeps the name its first execution generated. A declared name needed no change, since putLifecycleHook is idempotent on it. Both follow EcsCapacityCfnProvisioner. Neither surfaced in CI because no test here ran an UpdateStack, so each provisioner now has one that does. * fix(cloudformation): a createOnly change on a flow log or lifecycle hook is reported Both provisioners reuse the resource the stack already made, so a change to a property AWS treats as createOnly was being absorbed instead of surfaced. The flow log reported the stack complete while DescribeFlowLogs kept serving the previous ResourceId, TrafficType, LogDestination, LogFormat or aggregation interval. The lifecycle hook was worse, since changing LifecycleHookName or AutoScalingGroupName created the new hook and overwrote the id delete uses, leaving the previous hook on its group and still firing. Both now report an unsupported replacement, matching how EcsCapacityCfnProvisioner treats a changed Name. A property the template stops declaring, or one the stored record never captured, is left alone rather than read as a change. * docs(cloudformation): list ApiGateway Account, LifecycleHook and FlowLog in the resource-type table * fix(cloudformation): dropping a flow log's createOnly property is a change rejectIfChanged returned early whenever the template supplied no value, so removing a previously explicit LogFormat or MaxAggregationInterval skipped validation entirely and the stack reported complete while DescribeFlowLogs kept serving the old one. An absent stored value still means leave it alone, since that is not evidence of a different one, but an absent requested value is now compared rather than skipped. MaxAggregationInterval compares against its documented default of 600 when the template omits it, which is the value a create would have used. * fix(cloudformation): a flow log's createOnly comparison uses effective values Removing the early return on a blank request fixed the dropped-property case and broke two others. createFlowLog defaults ResourceType, TrafficType and LogDestinationType, so re-applying an unchanged template compared null against a stored default and failed a no-op update, while adding a property to a log that never had one still returned early on the stored null and was ignored. Both sides are now the effective value, defaulting the requested side exactly as createFlowLog does, so add, drop and change all read as changes and a re-apply stays a no-op. The test helper stamps the same three defaults, since a stub without them is not a flow log this provisioner could have created. |
||
|
|
5e01c07b33 |
feat(cloudformation): provision the network ACL family (#2001)
* feat(cloudformation): provision the network ACL family AWS::EC2::NetworkAcl, NetworkAclEntry (rule number, protocol, action, egress flag, CIDR, port range), and SubnetNetworkAclAssociation (CFN semantics: find the subnet's live association and replace it onto the target ACL) — all mapped onto existing Ec2Service APIs. Fixes #2000 * refactor(cloudformation): move the network ACL family to a per-service provisioner Ec2NetworkAclCfnProvisioner serves AWS::EC2::NetworkAcl, AWS::EC2::NetworkAclEntry and AWS::EC2::SubnetNetworkAclAssociation through the CfnResourceProvisioner seam, so the three types leave the switch in CloudFormationResourceProvisioner along with their private provision methods. The class is CDI-discovered by CloudFormationResourceRegistry, needs no registration, and injects only Ec2Service. delete() now covers all three types, so stack deletion cleans them up instead of leaking them. The ACL and the entry delegate to Ec2Service; the subnet association reverts the subnet to its VPC's default ACL, matching CloudFormation. NotFound is treated as already-deleted so a retried delete does not fail the stack. Entry properties resolve through the template engine rather than being read raw off the JSON, so RuleNumber, Egress and the PortRange bounds accept intrinsics such as Ref and Fn::Sub like the other properties already did. The integration test now deletes the stack and asserts the custom ACL is gone. A unit test covers the family in isolation with one mocked service. * fix(cloudformation): a stack update reuses its network ACL and upserts entries provisionNetworkAcl called createNetworkAcl unconditionally. CloudFormationService re-invokes provision with the prior physicalId on UpdateStack, so every update minted a second ACL, overwrote the id, and orphaned the previous one permanently. It now reuses the ACL this stack already made, creating only when that one is absent, and reports an unsupported replacement when VpcId changes, since VpcId is createOnly. Same shape as EcsCapacityCfnProvisioner. Fixing that alone broke the entry path: createNetworkAclEntry ran with replace=false, which raises NetworkAclEntryAlreadyExists for a rule that already exists. RuleNumber, Egress and NetworkAclId are the createOnly key, so re-provisioning the same key is an update, and replace=true is correct. Neither showed up in CI, since no test here ran an UpdateStack. Three now do. * docs(cloudformation): list the network ACL family in the resource-type table |
||
|
|
0971cf6f64 |
fix(cloudformation): resolve ASG launch templates by id and MixedInstancesPolicy (#2005) (#2019)
An AWS::AutoScaling::AutoScalingGroup that pointed at its launch template any way other than by LaunchTemplateName failed with "The specified launch template does not exist." provisionAutoScalingGroup collapsed LaunchTemplateId into the launch template name argument, and Auto Scaling matches names exactly, so a valid lt- id — including one that a Ref to an in-stack AWS::EC2::LaunchTemplate resolves to — never matched. The id and name are now passed to createAutoScalingGroup separately. MixedInstancesPolicy was never read from template properties, so a mixed-instances group reached Auto Scaling with no launch source and failed validation. It is now built in the same shape the Query API parser produces, including Overrides[].InstanceType and InstancesDistribution; a non-integer distribution value fails the stack rather than being silently dropped. CloudFormationAsgLaunchTemplateIntegrationTest covers resolution by name, by id, through a Ref to an in-stack launch template, and through MixedInstancesPolicy. Closes #2005 Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> |
||
|
|
7d66bf087a |
fix(cloudformation): expand SAM AutoPublishAlias into Version + Alias (#1961)
* fix(cloudformation): expand SAM AutoPublishAlias
AutoPublishAlias was read nowhere in the codebase, so the SAM transform
silently dropped it: the stack reached CREATE_COMPLETE, the function
deployed with only $LATEST, and an alias-qualified invoke then failed
with "Alias not found" far from the deploy that caused it. The
"Unsupported SAM resource type" debug arm only covers unknown resource
types, not unknown properties, so nothing was logged either.
Expand it into the AWS::Lambda::Version + AWS::Lambda::Alias pair real
SAM generates, and provision those two types. Both halves are needed:
the transform alone emits resources the provisioner ignores, and the
provisioner alone is unreachable from a SAM template.
The Lambda service already implements publishVersion and the alias APIs,
so this is plumbing rather than new service behavior. The new types go
through CfnResourceProvisioner rather than the legacy switch, following
the registry migration. Ref/GetAtt on the emitted properties give the
function -> version -> alias ordering that topologicalSort already
follows, so no explicit DependsOn is needed.
An intrinsic alias name (e.g. !Ref StageName) is passed through to Name
for the engine to resolve at provision time; only the generated logical
id needs a literal and drops the suffix in that case.
* test(cloudformation): cover Version/Alias provisioner directly
The SAM integration test drives provisioning end to end but cannot reach
two paths: the already-exists fallback (createAlias conflicting with an
alias that outlived a stack delete) and delete(), which its @AfterEach
invokes but never asserts on — a broken delete was silent.
Add LambdaVersionAliasCfnProvisionerTest alongside the existing Sqs and
Rds provisioner tests: attribute wiring for both types, the conflict
fallback, non-conflict failures still propagating, alias delete parsed
out of the ARN, delete idempotency when the alias is already gone,
version delete as a no-op, and a physical id that is not an alias ARN
(the generic fallback's shape on stacks predating this provisioner).
Also stop pinning the alias's FunctionVersion to a literal "1" in the
integration test: assert it is a number and not $LATEST, which is what
the assertion is actually for. Pinning the first version fails
confusingly when an earlier run leaks the function and its counter.
* fix(cloudformation): point the SAM alias at $LATEST
Real SAM points AutoPublishAlias at the published version, and the first
revision of this change did the same. Floci cannot invoke a published
version: the snapshot carries no code path, so a version-qualified
invoke times out on a cold start (#1987), and silently runs $LATEST's
code when a warm container happens to exist (#1988). Emitting the
faithful form therefore broke the alias-qualified invoke this expansion
exists to enable — strictly worse than not expanding the property.
Point the alias at $LATEST instead. The Version resource is still
emitted, so the resource set and GetAtt still match SAM; only the
alias target differs, and it flips back to the version in one line once
#1987 lands.
The integration test asserted the alias record existed with a numeric
FunctionVersion, which the broken form satisfied — so it passed while
the behavior was broken. It now invokes through the alias and asserts
the function actually runs, which fails against the version-pointing
form (verified by reverting it with the record assertion relaxed).
* fix(cloudformation): point the SAM alias at $LATEST
Restores the change
|
||
|
|
a235b76835 |
feat(cloudformation): implement GetTemplateSummary (#2148)
* feat(cloudformation): implement GetTemplateSummary (#1964) Adds the missing action to the CloudFormation Query allowlist and computes Parameters, ResourceTypes, Version, DeclaredTransforms and an informational Capabilities/CapabilitiesReason (derived from AWS::IAM:: resource types) from a stack's existing template, an inline TemplateBody, or a TemplateURL. Without this, tools like sam deploy that call GetTemplateSummary before UpdateStack failed with UnsupportedOperation. * fix(cloudformation): correct GetTemplateSummary for SAM stacks and named IAM resources Addresses two review findings: - StackName lookups summarized the persisted post-transform template, so an existing SAM stack lost its Transform declaration and reported expanded resource types (AWS::Lambda::Function) instead of the original submitted ones (AWS::Serverless::Function). Stack now keeps the pre-transform template body alongside the existing post-transform one, and GetTemplateSummary prefers it. - Capabilities always reported CAPABILITY_IAM for any IAM resource, even ones with an explicit name (e.g. RoleName). CloudFormation requires CAPABILITY_NAMED_IAM for those; GetTemplateSummary now checks the relevant name property per IAM resource type. * fix(cloudformation): detect named IAM resources set via intrinsic functions The CAPABILITY_NAMED_IAM check only looked for a literal string value on the name property, so a real-world RoleName/UserName/etc. set via Ref, Fn::Sub, Fn::Join or another intrinsic (the common shape in SAM and CDK output) was missed entirely, misclassifying the template as only needing CAPABILITY_IAM. CloudFormation requires NAMED_IAM whenever the property is present at all, regardless of how its value resolves, so the check now looks for presence instead of a textual value. * docs(cloudformation): clarify GetTemplateSummary's originalTemplateBody fallback Spells out why the fallback to the post-transform templateBody exists (originalTemplateBody has no data for stacks persisted before this field was added) and that it self-heals on the stack's next CreateChangeSet/UpdateStack call, in response to review feedback. |
||
|
|
d9e4447aeb |
feat(cloudformation): resolve dynamic references in RDS credentials (#1809)
* feat(cloudformation): resolve dynamic references in RDS credentials * test(cloudformation): pin secret resolution failures --------- Co-authored-by: Alexander Banna <abanna@users.noreply.github.com> |
||
|
|
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> |
||
|
|
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. |
||
|
|
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 |
||
|
|
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> |
||
|
|
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 |
||
|
|
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). |
||
|
|
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. |
||
|
|
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). |
||
|
|
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 |
||
|
|
271f27da62 | fix(cfn): reconcile lambda functions on update (#736) | ||
|
|
f30bd79d67 | chore: release 1.5.10 | ||
|
|
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 |
||
|
|
794939c331 | Add support for CloudFormation's DeleteChangeSet | ||
|
|
61433f59ab | firt commit |