Commit Graph
153 Commits
Author SHA1 Message Date
Ronald Li 🛠️ cfbf86b8a1 fix(cloudformation): keep tags added outside the stack on EC2 VPCs, security groups and instances (#7534) 2026-11-04 18:17:51 -04:00
Mario Toffia b35e51374c feat(cloudformation): provision signing profiles and code signing configs (#7546) 2026-11-04 18:11:33 -04:00
Oleksandr Nikolaichuk 0c3af7dc4b fix(cloudformation): roll back an AppSync update when a later resource fails (#7186)
A failed stack update left AppSync entities changed or cleared by the update:
the provisioner had no rollbackUpdate, so the stack ended in
UPDATE_ROLLBACK_FAILED with "Rollback is not implemented".

Before an in-place update of a GraphQL API, data source, function, resolver or
API key, the provisioner records the members the update can change or clear.
The service applies an update member by containsKey, so replaying them puts
back both the changed and the cleared values. An update that fails part way
undoes itself through CfnRollback.guarded, and a failed undo keeps the
snapshot for ContinueUpdateRollback.

GraphQLSchema and a replaced AppSync resource are not covered.

tagResource, untagResource and putEnvironmentVariables change the stored API in place while updateGraphqlApi saves a copy, so a copy could overwrite a tag or variable written in between. Every method that writes a store now holds the service monitor, as startSchemaCreation does, and startSchemaCreation checks the API under it too. refreshGraphqlApiUris refreshes the stored API under the monitor instead of putting the instance it read earlier.
2026-11-04 16:25:04 -04:00
Jackson Price 31451dfff3 fix(cloudformation): preserve mapped list values (#7511) 2026-11-04 14:05:30 -04:00
Ronald Li 🛠️ dbbf22957f fix(cloudformation): apply an AWS::EC2::FlowLog's Tags (#7490) 2026-11-04 06:49:14 -04:00
mokamoto12 8b756a3467 fix(cloudformation): apply KinesisStreamSpecification on AWS::DynamoDB::Table (#7464)
* fix(cloudformation): apply KinesisStreamSpecification on AWS::DynamoDB::Table

The property was accepted and ignored, so a stack that declared it got a
table whose item changes never reached the stream.

The declared stream becomes the table's active Kinesis streaming
destination on create and update. Removing a block the previous template
declared turns it off, and a stack that never declared it leaves
destinations set outside it alone. The in-place update snapshot of a
stack that manages the destinations records them, so a failed update
puts them back as they were.

A change of ApproximateCreationDateTimePrecision alone updates the active
destination in place, as CloudFormation does with one
UpdateKinesisStreamingDestination call, so forwarding never stops and
records already captured are still delivered.

A block that is not an object fails template validation, as
TimeToLiveSpecification does, rather than reading as a removed block
that turns forwarding off.

A StreamArn the destination cannot use fails the table as the AWS handler
does, and the table this attempt created is deleted. One under 37
characters fails EnableKinesisStreamingDestination's validation. One that
is not a Kinesis stream ARN, such as the stream name Ref returns, or one
naming a stream that does not exist fails as NotStabilized.

DynamoDbTableAccess gains enable, disable and update operations for the
destination. DynamoDB Local has no Kinesis forwarding, so that backend
leaves the table as it is and logs a warning. CloudFormation still checks
StreamArn there as AWS does; only the forwarding is skipped.

* fix(cloudformation): match Kinesis destinations by their whole stream ARN

A destination was looked up by the last segment of its StreamArn in the
table's account and region, so an ARN for another account, region or
resource type that ended in a local stream's name forwarded to that
stream. KinesisService.describeStreamByArn now finds a stream only by its
exact ARN. NativeDynamoDbTableService uses it, so the public
EnableKinesisStreamingDestination action reports such an ARN as not
found, and CloudFormation fails the table as NotStabilized.

The DynamoDB Local backend looks the stream up the same way before it
skips forwarding, so a template naming a missing stream fails there too.

A declared StreamArn the table already forwards to now goes through the
same template checks as a new one; only the rollback restore skips them.
2026-11-03 23:10:27 -04:00
Ruslan Sovinskyy 4ba9a55a3a feat(cloudformation): provision event bus v2 and subscriber (#7260) 2026-11-03 17:27:11 -04:00
Rashen Anupama fad0493169 fix(cloudformation): propagate tags to nested stacks (#7383) 2026-11-03 16:47:32 -04:00
Allen Sanborn fbfe9048a1 fix(ec2): support NAT gateway secondary addresses (#7327)
* fix(ec2): support NAT gateway secondary addresses

* fix(ec2): update a NAT gateway's secondary addresses in place

A CloudFormation update that changed only a NAT gateway's Secondary*
properties replaced the gateway. The replacement was created while the old
gateway still held its Elastic IP or fixed private address, so it came back
failed with Resource.AlreadyAssociated (or InvalidIPAddress.InUse) and the
update failed. The schema does not mark the secondaries create-only, so AWS
changes them in place and the gateway keeps its id.

Ec2Service.updateNatGatewaySecondaryAddresses sets a gateway's secondaries
to the requested ones: kept ones stay, dropped Elastic IPs are handed back,
new ones are checked as CreateNatGateway checks them, and every check runs
before anything changes. The provisioner calls it instead of replacing, and
records the prior secondaries so a rolled-back update puts them back.

* fix(ec2): keep a NAT gateway's picked secondary when listed ones change

The counted slots of an in-place secondary update kept the first secondary
with no Elastic IP and an address the request does not list. With
SecondaryPrivateIpAddresses [A] and a count of 1 changed to [B] and 1, that
was the dropped listed A, while the address the subnet had picked was given
up. Counted addresses always follow the listed ones, so the counted slots now
keep the last such secondaries, in order.

Tests cover a count changed in place (an unrelated change keeps the same
addresses; 1 to 2 keeps the first; 2 to 1 keeps one of them), the picked
address surviving a listed change, and secondary Elastic IPs swapped between
listed addresses or moved to a new one, with DescribeAddresses showing each
held at its new address.

* test(ec2): pin which counted NAT gateway secondary an update keeps

The counted slots keep the last unlisted secondaries, so a count lowered
from 2 to 1 keeps the second address; the test now asserts that, and that
raising the count from 1 to 2 adds a new address in the subnet after the
kept one. The comment no longer claims counted addresses always follow the
listed ones: slot position is the only record of an address's origin, and
across updates a once-listed address can move behind a picked one.

* fix(ec2): read a NAT gateway under the allocation lock before updating its secondaries

The secondary-address update read the gateway before taking the lock that
DeleteNatGateway holds. A delete finishing in between left the update
holding a stale copy, which it then wrote back, re-associating the Elastic
IPs the delete had released and overwriting the association of a gateway
that had since taken the primary one. The gateway is now read again under
the lock, and one that is gone or deleted is refused with NatGatewayNotFound.

* test(cloudformation): read NAT gateway addresses through XmlParser

The secondary-address tests picked addresses out of DescribeNatGateways and
DescribeAddresses with a regular expression and substring checks that
depended on element order. They now select the non-primary items of
natGatewayAddressSet through XmlParser.

* test(ec2): cover a NAT gateway stored as deleted by a racing tag write

CreateTags writes a NAT gateway back under the gateway's tag lock, which
DeleteNatGateway does not take. A tag write that read the gateway before a
delete therefore stores the very record the delete marked deleted, so the
secondary-address update's deleted-state check is reachable. The test pauses
the tag write's put, deletes the gateway, lets the put finish, and asserts
the update refuses the record with NatGatewayNotFound and holds no Elastic
IP for it.

* refactor(ec2): fill a NAT gateway's address slots in one place

CreateNatGateway and the secondary-address update each walked the gateway's
slots the same way: take the listed Elastic IP and address at each
position, assign a free address where none is listed, build the address,
and give back what was assigned if a later slot fails. Both now call
fillNatGatewaySlots. Create passes its primary address as slot 0 and marks
it primary afterwards; the update passes the slots its kept secondaries
already fill. The order addresses are assigned in, the error codes and the
release on failure are unchanged.

* test(ec2): cover NAT gateway lease release and reuse the shared test helpers

No test covered the lease a NAT gateway gives back when its addresses run
out part way, so the shared slot-filling walk could lose its release with
every test green. Two tests now run a /28 subnet out of addresses, one
through CreateNatGateway and one through a secondary-address update, and
verify the lease taken on the VPC network is released and that the update
leaves the gateway as it was.

The concurrent-delete test now builds its service with mockModeService()
and waits for the blocked update with ThreadStates.awaitBlockedOrDone.

* test(ec2): build the small NAT subnet with privateSubnet
2026-11-03 14:15:02 -04:00
Andre Kurait 240193e624 fix(cloudformation): apply IAM role session duration (#7405) 2026-11-03 09:31:36 -04:00
Ronald Li 🛠️ d0747f26d1 feat(cloudformation): provision Cognito user pool identity providers (#7350) 2026-11-03 08:21:09 -04:00
Niels Kootstra 70a185a3aa fix(cloudformation): delete a stack whose create is still running only once the create stops (#7358)
* fix(cloudformation): delete a stack whose create is still running only once the create stops

* fix(cloudformation): leave a deferred delete to the execution it waits on and report its failure

* fix(cloudformation): refuse a new execution once a delete has been deferred

* test(cloudformation): wait for stack statuses with the shared CfnStackWaits helper
2026-11-03 08:06:48 -04:00
Oleksandr Nikolaichuk 42bc856258 test(cloudformation): run the schema coverage ratchet in CI (#7282) 2026-11-02 07:37:06 -04:00
Jackson Price be315bf160 feat(cloudformation): provision AWS::EC2::KeyPair with its private key in Parameter Store (#7128)
* feat(cloudformation): provision AWS::EC2::KeyPair with its private key in Parameter Store

AWS::EC2::KeyPair had no provisioner, so a stack stubbed it: the stack
reached CREATE_COMPLETE without creating a key, Ref returned a made-up
id and Fn::GetAtt returned the literal "Key.KeyPairId". A template that
creates a key pair for an instance, as the AWS::EC2::KeyPair reference
shows, got nothing to log in with.

The new provisioner does what that reference describes:

- Without PublicKeyMaterial it calls CreateKeyPair with the template's
  KeyType and KeyFormat, so rsa and ed25519 keys and pem and ppk files
  all work, and stores the private key in the SecureString parameter
  /ec2/keypair/<KeyPairId>. With PublicKeyMaterial it imports the key,
  takes the key's type from the material (KeyType is ignored, as
  documented) and writes no parameter.
- Ref is the key name; Fn::GetAtt KeyPairId and KeyFingerprint are the
  key's own.
- Tags are applied once the key exists and the parameter is written
  last, so a step that fails leaves only the key to undo. Deleting a
  created key deletes its parameter first, on stack delete, rollback
  and replacement cleanup alike; a key or parameter already gone counts
  as deleted. A key is deleted by its name, as Cloud Control's
  DeleteResource names it; a key deleted outside the stack still has
  its parameter deleted with the stack.
- Only AWS::NoValue leaves a property out; an empty string a parameter
  supplies is a value, as the same string written literally is. An
  empty PublicKeyMaterial fails with the MissingParameter error
  ImportKeyPair gives for it.
- Every property is create-only (the registry schema has no update
  handler) and KeyName is required. An update that changes another
  property under the same name is refused with CloudFormation's
  custom-named replacement error. A rename creates the new key, then
  deletes the old one with its parameter once the update commits, or
  deletes the new one if the update rolls back.

The create-only list is added to create-only-properties.json, so a
change set reports a changed name or type as a replacement, and the
generated resource-type table lists KeyPair.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): delete orphaned key pair parameters on cleanup

Replacement cleanup and rollback delete a displaced or rolled-back
AWS::EC2::KeyPair by name only. When that key had already been deleted
outside the stack, its /ec2/keypair/<KeyPairId> SecureString parameter
was left behind.

Record the id of each created key the resource still owes a delete,
keyed by name, so the cleanup, the rollback and a rollback retry also
delete that key's parameter. Imported keys have no parameter and are
not recorded.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): end a key pair's rollback retry when an update starts

A rollback that could not delete a renamed key pair's replacement leaves
it owed for ContinueUpdateRollback. Once that skipped the resource, a
later update that failed before creating anything rolled back by
retrying that old delete instead of undoing itself, and could end in
UPDATE_ROLLBACK_FAILED.

Call ReplacementCleanup.endRollbackRetry as an update starts, as the
other replacing provisioners do. The replacement stays listed, so the
next committed update or the stack delete still removes it.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): say the rollback retry test pins a helper contract

The test added with the endRollbackRetry call rolls back the same
resource whose update failed. The engine does not do that for a key
pair today: it restores the previous resource and skips its rollback,
so the earlier commit's UPDATE_ROLLBACK_FAILED scenario is not
reachable yet. Say that the test pins the ReplacementCleanup contract
instead.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): clean up partial KeyPair parameter writes

* refactor(cloudformation): share KeyPair create-only tracking

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-31 18:03:31 -04:00
Oleksandr Nikolaichuk f55948cbcc fix(cloudformation): clear EC2 network tags and properties the new template drops (#7124)
A property the previous template declared and the new one drops is now
cleared on update for the EC2 network types: Tags on Subnet,
InternetGateway, RouteTable, NatGateway, EIP and PrefixList, and
MapPublicIpOnLaunch on Subnet, which goes back to false. A property the
stack never declared keeps what was set outside it. A failed update puts
the cleared tags and the flag back from the existing in-place snapshot.

Refs #6606
2026-10-31 16:46:29 -04:00
Rashen Anupama 7569a9a8ec fix(cloudformation): transform SAM layer versions (#7062)
* fix(cloudformation): transform SAM layer versions

Map packaged layer content to Lambda layers, retain version-specific resource identities, and preserve references and retention behavior. Cover publication, replacement and deletion through CloudFormation.

* fix(cloudformation): preserve typed and inherited SAM layer references

Rewrite captured Globals references, retain typed list references for provisioning, and restrict dependency rewriting to resource attributes. Cover each case in unit regressions and stack creation/update.

* fix(cloudformation): keep Fn::Sub overlay variables out of parameter substitution

A variable map localizes names for the template engine, so resolving a
same-named stack parameter first consumed the placeholder and left the map
dead: Key: !Sub ['${Key}', {Key: 'layer.zip'}] published the parameter's
value instead of the layer package the author named.

* refactor(cloudformation): fold SAM logical-id hashing into one helper

The layer-version and function-version generated ids serialized their hash
input the same way - properties sorted, non-ASCII escaped, DEL escaped, then
the first ten hex digits of the SHA-1 - but as two copies. Extract samHashSuffix
so a generated id is its subject plus one shared suffix. Ids are unchanged.

* fix(cloudformation): deploy SAM layers from original content expressions

The transform resolved ContentUri parameters before copying them onto the
generated AWS::Lambda::LayerVersion, so a parameter value that itself held
a ${...} was published inside a Fn::Sub and CloudFormation substituted it a
second time at deploy. Deploy the bucket and key expressions as written and
let the template engine resolve them once; keep the resolved copy only as
the hash input, so a versioned package still yields a distinct logical id.

* fix(cloudformation): keep Fn::Sub local variables out of layer rewrites

The recursive layer-reference walk re-entered an Fn::Sub node through the
blanket children loop, so it treated a variable map as another expression.
With a local variable literally named Ref whose value was a layer's logical
id, the walk rewrote that literal into the generated id and changed what the
stack deployed. Rewrite only the map's values as intrinsic contexts and skip
the already-handled Fn::Sub node in the walk.

* fix(lambda): read a layer's pinned S3 object version

A SAM layer with a packaged ContentUri.Version, or an
AWS::Lambda::LayerVersion whose Content sets S3ObjectVersion, publishes that
pinned package, but the provisioner fetched the object with a null version
and so read the latest one. If the key changed after publishing, the layer
ended up with different code than the template requested. Pass
S3ObjectVersion through to the S3 read so a pinned package stays pinned.

* fix(cloudformation): resolve a whole ContentUri reference before splitting it

Keeping the original ContentUri expressions on the generated layer means a
ContentUri that is itself a parameter reference arrives as a Ref object with
no Bucket or Key, and the transform rejected the stack. Resolve such a
reference to the location it names and split that, while the object form
keeps its expressions for the template engine to resolve at deploy.
2026-10-31 13:20:11 -04:00
Mario Toffia 7cf516a14d fix(cloudformation): honor retained resources on stack deletion (#6723)
* fix(cloudformation): honor retained resources on stack deletion

* test(cloudformation): assert the unretained sibling bucket is removed

* fix(cloudformation): skip every retained resource, whatever its status

A DELETE_FAILED stack can hold a CREATE_FAILED resource that the delete
never touches, because floci only deletes a failed resource it owns for
rollback. Naming it in RetainResources was accepted but left it
CREATE_FAILED with no DELETE_SKIPPED event. AWS reports every retained
resource DELETE_SKIPPED, so the retain check now runs before the
deletability guard.

* test(cloudformation): build the retain integration test on the shared CFN helpers

Use CfnStackWaits.awaitStatus, which also fails at once on another
terminal status, instead of a private poll, and CfnRequests.cfn for the
Query requests.
2026-10-31 12:15:25 -04:00
Vinícius Ribeiro f0a1b11385 fix(cloudformation): keep SMS_MFA on a user pool update until MFA is turned off (#7088)
* fix(cloudformation): keep SMS_MFA on a user pool update until MFA is turned off

The AWS::Cognito::UserPool reference says that once SMS_MFA is enabled, only
MfaConfiguration OFF turns it off. An update that stopped listing SMS_MFA in
EnabledMfas cleared it. replaceUserPoolMfaConfig now keeps the pool's SMS
setting when none is given and the mode is not OFF.

Closes #7086

* fix(cognito): keep SMS MFA with the pool's current SMS settings

Keeping SMS MFA replayed the settings it was enabled with, so an update that
dropped SMS_MFA and changed SmsAuthenticationMessage or SmsConfiguration put
the old values back over the ones updateUserPool had just applied. The kept
SMS MFA now takes the pool's current message and SMS configuration.
2026-10-31 11:52:52 -04:00
Oleksandr Nikolaichuk 5e9df931e3 fix(cloudformation): clear an AppSync property the new template drops on update (#6995)
* fix(cloudformation): clear an AppSync property the new template drops on update

An update whose template drops a property the previous template declared now clears it on the five AppSync types, and one the stack never declared keeps the value set outside it. ProvisionContext.droppedProperties names the dropped properties.

* test(cloudformation): move the AppSync removal case into AppSyncCfnIntegrationTest

The case reuses the class's helpers, now built on CfnRequests.cfn, instead of a second copy. Documents the AppSync update rule next to the AWS::NoValue section.
2026-10-31 10:22:30 -04:00
Suja Shaj dcf8ec7430 fix(ec2): report NAT gateways as zonal and honor PrivateIpAddress (#7059)
* fix(ec2): report NAT gateways as zonal and honor PrivateIpAddress

The Terraform AWS provider reads network_interface_id, private_ip and
public_ip from a NAT gateway only when it is reported with
availabilityMode zonal. Floci never sent availabilityMode, so all three
stayed null. Every gateway Floci creates sits in one subnet, so the
responses now say zonal.

Floci has no regional NAT gateways. A regional request that named only
its VPC failed on the missing subnet, and one that also named a subnet
got a zonal gateway, through both CreateNatGateway and
AWS::EC2::NatGateway. Both now refuse AvailabilityMode regional with
UnsupportedOperation. Any other value except zonal, such as Regional,
fails with InvalidParameterValue instead of creating a zonal gateway.

Once Terraform reads private_ip back, the gateway has to hold the
address it was asked for. private_ip forces a new gateway, and
CreateNatGateway ignored PrivateIpAddress, so a config that set it
would plan a replacement on every run. CreateNatGateway and
AWS::EC2::NatGateway now give the gateway's interface the requested
address, checked by the same rules as RunInstances: inside the subnet,
not reserved and not in use. A changed PrivateIpAddress replaces the
CloudFormation resource, as it is createOnly. A gateway has its primary
address only, so SecondaryAllocationIds, SecondaryPrivateIpAddresses
and SecondaryPrivateIpAddressCount are refused with
UnsupportedOperation instead of being dropped.

AWS::EC2::NatGateway also sets EniId, the gateway's primary interface,
which Fn::GetAtt resolved to the literal "Nat.EniId" although the
gateway has had a real interface since #5622.

Closes #6767

* fix(ec2): take no VPC network lease for a NAT gateway's requested address

DeleteNatGateway never returns a lease, so the one CreateNatGateway took
for its PrivateIpAddress kept the address from automatic allocation
after the gateway was gone. Check that the address is free the way
CreateNetworkInterface does, without the lease; automatic allocation
already steps around addresses a stored NAT gateway holds.

Ec2NatGatewayAddressIntegrationTest now sends its requests through the
shared Ec2Requests.ec2 instead of its own copy.
2026-10-31 05:32:32 -04:00
Vinícius Ribeiro ebdac90574 fix(cloudformation): apply EnabledMfas on AWS::Cognito::UserPool (#7046)
* fix(cloudformation): apply EnabledMfas on AWS::Cognito::UserPool

* docs(cloudformation): move the EnabledMfas note to the resource-type table source

* fix(cloudformation): drop the MFA factors EnabledMfas no longer lists on update

* fix(cognito): apply EnabledMfas mode and factors in one write

* fix(cloudformation): roll back EnabledMfas with the rest of the user pool

* fix(cognito): serialize whole-pool writes behind a per-pool lock

replaceUserPoolMfaConfig stores a copy of the pool, so a TagResource that
landed between the copy and the write was lost. Tag and untag locked the
pool instance, which the copy replaces, so they did not exclude it.

Every write that reads a pool and stores it back whole now holds a lock
keyed by the pool id and reads the pool inside it.
2026-10-31 05:15:29 -04:00
Aniket Shukla f48c3a9c01 feat(cloudformation): provision SES receipt rules (#7040) 2026-10-30 18:09:09 -04:00
Oleksandr Nikolaichuk e54b072afb test(cloudformation): ratchet the writable properties each provisioner reads (#6807)
* test(cloudformation): ratchet the writable properties each provisioner reads

* test(cloudformation): use colons in the coverage messages and scope the docs paragraph to the corpus

* test(cloudformation): list the writable properties main and the schema added since the ratchet
2026-10-30 07:05:45 -04:00
Jackson Price fee688bd05 feat(cloudformation): support four AWS::AppConfig resource types (#6791) 2026-10-29 12:59:23 -04:00
TATSUNO “Taz” Yasuhiro c4ae11c414 feat(cloudformation): expose RegionalEndpoints of a web function endpoint to Fn::GetAtt (#6907) 2026-10-29 08:25:24 -04:00
Vũ Thế Huy d3c4732b31 feat(cloudformation): provision Redshift event subscriptions (#6664)
* feat(redshift): support event history and SNS notifications

* fix(redshift): guard stale delivery failures and prune all event scopes

* feat(cloudformation): provision Redshift event subscriptions

* fix(redshift): scope snapshot events and serialize subscription tag mutations

* feat(cloudformation): provision Redshift event subscriptions

* fix(cloudformation): resolve Redshift subscription list parameters

Use the shared list reader for SourceIds and EventCategories. Cover CommaDelimitedList and List<String> parameters through the AWS SDK and verify concurrent tag requests preserve CloudFormation tag updates.

* fix(redshift): honor event disablement and restore rollback attributes

Check the EventBridge external service key before publishing API events. Snapshot and restore CloudFormation resource attributes alongside subscription state during in-place rollback.

* fix(redshift): drop API event publisher and share subscription setup

Remove RedshiftApiEventPublisher, its handler hook, tests and docs, which are not part of the CloudFormation resource and emit CloudTrail-style events without a trail. Route createSubscription and replaceSubscription through one helper that normalizes the subscription fields.
2026-10-27 23:28:52 -04:00
Jackson Price a6cf29ea86 fix(cloudformation): copy a SAM function's VersionDescription to its version (#6770)
With AutoPublishAlias, SAM passes a function's VersionDescription to the
Description of the AWS::Lambda::Version it generates. The transform
dropped it, so a version published from a SAM template never had the
description the template gave it.

The version now takes it as written, leaving an intrinsic function for
CloudFormation to resolve. As in SAM, it stays out of the hash that
names the version, and Globals cannot set it: the transform refuses it
there, as it already refuses AutoPublishCodeSha256.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-27 19:13:02 -04:00
Jackson Price f3f8b42200 feat(cloudformation): support AWS::Route53::RecordSetGroup (#6676)
A RecordSetGroup writes all its record sets into one hosted zone in a
single ChangeResourceRecordSets batch, so a record set that cannot be
written, such as a name another owner already holds, leaves the zone
unchanged and fails the stack. Each record set keeps what a RecordSet
keeps, including the routing-policy fields SetIdentifier, Weight,
Region, Failover and HealthCheckId; entries an Fn::If resolves to
AWS::NoValue are dropped, and two record sets with one name, type and
set identifier are refused. Ref returns the group's logical ID and
Fn::GetAtt Id the change ID that GetChange reads, as AWS documents.

The zone comes from the group's HostedZoneId or HostedZoneName, or from
its record sets when the group names neither. A record set that repeats
the group's HostedZoneId is refused, as AWS documents, and so is one
that names another zone.

An update in the same zone deletes the records the group wrote and
creates the new ones in one batch. HostedZoneId and HostedZoneName are
create-only, so a change set reports a zone change as a replacement:
the records are written into the new zone, and the old ones are deleted
once the update commits, or kept under UpdateReplacePolicy: Retain. A
failed update puts back the records the group had; after a zone change
the group first points at its old records again, then deletes the new
zone's. If that delete fails, ContinueUpdateRollback retries it and
DeleteStack deletes those records while the rollback is unfinished;
anything else leaves them in their zone, since Route 53 cannot tell
them apart from an identical record another writer puts there later.
Deletes name the values the group wrote, so a record changed outside
the stack fails the delete rather than being removed.

The docs say what a record set group's failed rollback leaves behind.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-26 17:10:49 -04:00
Andre Kurait 07597598b6 fix(cloudformation): relocate SAM schemes without auth defaults (#6656)
* fix(cloudformation): relocate SAM schemes without auth defaults

Follow the separate postprocessing request in upstream #6638. Relocate declared OpenAPI security schemes independently of Auth defaults, preserving Swagger and operation requirements.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

* fix(sam): centralize OpenAPI security scheme relocation

Keep the defaults helper responsible only for generating AWS_IAM and api_key definitions. Relocate the security scheme map exclusively in the shared final OpenAPI phase, including documents without Auth defaults.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>

---------

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-10-26 13:49:34 -04:00
Andre Kurait 9b36aa6980 fix(cloudformation): replace SAM OpenAPI security schemes (#6638)
Follow the separate whole-map replacement requested in upstream #6632. Preserve Swagger, no-default behavior, operation requirements and unrelated OpenAPI components.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
2026-10-26 09:44:15 -04:00
TATSUNO “Taz” Yasuhiro 3438a00daf feat(lambda): version network connectors as AWS does (#6595)
* feat(lambdamicrovms): version network connectors as AWS does

* fix(lambda): lock connector versions and refresh them after a CFN rollback

Updates, deletes and version reads hold one lock, so two updates cannot
take the same version number.

A CloudFormation rollback restores the connector through an update. On
AWS that makes the next version, and a later Fn::GetAtt returns it. The
resource now keeps that version in LatestVersion and LatestVersionArn.

Read the connector ARN through AwsArnUtils.parse.

AWS refuses LatestVersion, an integer, as a string Output, so the stack
test reads LatestVersionArn only.

* fix(lambda): type the connector LatestVersion attribute as an integer

AWS::Lambda::NetworkConnector declares LatestVersion as an integer. On AWS
a stack whose string Output reads it fails with "Template format error:
Every Value member must be a string.", and Fn::Sub refuses it with
"variable Connector.LatestVersion in Fn::Sub expression does not resolve
to a string".

* chore(lambda): share the connector version ARN and integer attribute helpers
2026-10-26 08:38:47 -04:00
Andre Kurait f32db4fe49 fix(cloudformation): drop undeclared OpenAPI authorizer schemes (#6632) 2026-10-26 08:06:31 -04:00
Andre Kurait d903074d75 fix(cloudformation): preserve numeric GetAtt attributes (#6564) 2026-10-25 22:37:26 -04:00
Vũ Thế Huy 2a5f734777 feat: support managed credentials in Redshift restore (#6515) 2026-10-25 21:43:14 -04:00
Jackson Price 6acd90640d feat(cloudformation): provision AWS::EC2::PrefixList (#6481)
* feat(cloudformation): provision AWS::EC2::PrefixList

An AWS::EC2::PrefixList was stubbed: Ref returned "<LogicalId>-<8 hex>",
Fn::GetAtt the literal "<LogicalId>.<Attribute>", and EC2 held no list, so
a route given its Ref pointed at nothing. Ec2NetworkCfnProvisioner now
creates the customer-managed list through Ec2Service. Ref is its pl- id,
and Fn::GetAtt serves PrefixListId, Arn, OwnerId and Version, the
attributes the registry schema declares.

The schema has no create-only property, and create-only-properties.json
now says so. Without the entry, the engine's name heuristic took
PrefixListName for create-only, so a rename was planned as a replacement
of the list and of the routes and rules that reference it. An update
changes the list in place: its name, capacity, entries and tags. Adding or
removing entries makes a new version and a rename does not, as the EC2 API
reference says. EC2 refuses a request that removes and adds the same CIDR,
which is how a description changes (Terraform's
aws_ec2_managed_prefix_list records the error), so such an entry is added
back by a second ModifyManagedPrefixList call. The first call carries
everything EC2 could refuse, and the capacity the second needs is checked
before the first, so a change EC2 refuses leaves the list as it was. A
rollback puts the prior name, capacity, entries and tags back, and Version
follows the list.

Two updates fail before anything changes: another AddressFamily, which no
EC2 call can change on an existing list, and a new MaxEntries together
with changed Entries, which the CloudFormation and EC2 references both say
cannot change at once. MaxEntries is required to create a list, as the
CloudFormation reference says (aws/aws-cdk#35360 reports the deploy
failing without it); an update that leaves it out keeps the capacity.
Entries and Tags are brought to the template when it, or the previous one,
declares them, so entries or tags no template declared stay. Tags go
through CreateTags after the create, as on the other types in the
provisioner, so EC2 checks them; a tag it refuses fails the create and
removes the new list. A list gone out of band, or a stub an older Floci
left, is replaced by a new one, and a stack delete tolerates only
InvalidPrefixListID.NotFound.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): cover AWS::EC2::PrefixList through boto3

A stack's prefix list is created, resized, given new entries and deleted
through the CloudFormation and EC2 clients of the pinned boto3: Ref and
Fn::GetAtt name the list EC2 describes, a resize keeps the version, new
entries make version 2 of the same list, dropping Tags removes them, and
the list is gone after the stack delete.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* refactor(cloudformation): share optionalInt through ProvisionContext

Ec2NetworkCfnProvisioner and ElbV2CfnProvisioner each carried the same
private optionalInt. An absent, null or AWS::NoValue property stays unset;
a value written into the template, a literal blank included, has to be an
integer; anything else fails with ValidationError "Value of property
<name> must be an integer." It is now ProvisionContext.resolveOptionalInt,
beside resolveOptional, and all seven callers use it: the prefix list's
MaxEntries, the target group's Port and four health check settings, and
the gateway listener's Port.

The two copies differed only in Integer.parseInt against Integer.valueOf
and in building the error through a helper, so neither provisioner
changes behaviour. ProvisionContextTest covers the method directly.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-25 17:16:19 -04:00
Jackson PriceandPriamo Germosen 2705818ff1 fix(cloudformation): scope SAM REST auth defaults to each operation (#6358)
* fix(cloudformation): leave root security out of SAM REST auth defaults

AWS::Serverless::Api Auth (DefaultAuthorizer: AWS_IAM, ApiKeyRequired)
gave each operation without security of its own a copy of the
document's root security before adding the defaults. SAM reads only
the operation's own security and leaves the root security as written,
and API Gateway does not apply root-level security. As a result:

- a root requirement naming a SigV4 scheme or an authorizer, beside
  the generated AWS_IAM default, failed the import with "Only one
  Authorizer or IAM authorization is allowed per operation", where SAM
  gives the operation the one AWS_IAM requirement;
- other root requirements, such as an API key scheme, were copied into
  every operation and enforced, where AWS does not enforce them.

The defaults now start from the operation's own security. An Auth
that selects no default, such as ApiKeyRequired: false alone, now
leaves the body as written, as SAM does; it used to copy the root
security into every operation.

The docs also say that floci's REST importer still applies root-level
security to an operation that has none of its own, which API Gateway
does not.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): add SAM REST auth defaults inside Fn::If branches

An Fn::If written around a path item or an operation in the
DefinitionBody of an AWS::Serverless::Api kept the Auth defaults from
reaching the operation. A conditional path item was skipped, because
its only key is not a method, and a conditional operation got the
default beside the Fn::If, which the template engine drops when it
keeps the chosen branch. Either way the method was imported with
authorizationType NONE and answered unsigned calls, where SAM adds the
default inside each branch.

The defaults are now added inside each branch, skipping an
AWS::NoValue one, as SAM's get_conditional_contents does. When a
default applies, a nested Fn::If, or one whose value is not a list, is
refused with a ValidationError instead of being left without the
defaults.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): refuse SAM REST bodies that would lose the defaults

Some DefinitionBody shapes lost the generated AWS_IAM and api_key
schemes or requirements on their way to the REST importer, which then
imported the methods with authorizationType NONE:

- a securityDefinitions, components or securitySchemes map written as
  an intrinsic function such as Fn::If. The generated schemes were
  written beside the function, and the template engine keeps only its
  result;
- a body with an Fn::If key beside its own keys, which the engine
  replaces with the chosen branch;
- an existing AWS_IAM or api_key scheme with the expected fields and
  an Fn::If key, which the engine replaces with a branch that need not
  be that scheme;
- a body declaring both swagger: "2.0" and an openapi version. The
  transform wrote the schemes into securityDefinitions, which the
  importer, reading the body as OpenAPI 3, ignores.

When a default applies, these are now refused with a ValidationError,
as a path item written as a $ref already is.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): cover SAM REST root security through the SDK

The SDK suite creates a stack whose AWS::Serverless::Api root security
names its own SigV4 scheme, with DefaultAuthorizer: AWS_IAM, in Swagger
2.0 and OpenAPI 3.0. It checks that the stack deploys, that the
processed template keeps the root security and gives the operation the
one AWS_IAM requirement, and that the method is imported as AWS_IAM
without an API key.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin false Fn::If routes and conditional bodies

An Fn::If around a path item or an operation whose condition is false
resolves to AWS::NoValue. The transform adds no default to that
branch, and the REST importer creates no resource or method for it, so
the API has no such route, as on AWS, while the other routes keep the
AWS_IAM default.

A DefinitionBody written as an Fn::If is refused for any non-empty
Auth, ApiKeyRequired: false included. SAM refuses it too: for every
non-empty Auth, _add_auth checks SwaggerEditor.is_valid, which needs a
literal paths object. The docs now say so.

Neither behavior changes here; the tests keep both in place.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): say a SAM REST Auth needs a paths object

The sentence added in the previous commit said any non-empty Auth
needs a literal paths object. The transform, like SAM, accepts any
object there, a paths map written as Fn::If included when no default
is selected. What it refuses is a DefinitionBody without one, such as
a body written as Fn::If.

The previous commit's message also said a false Fn::If around an
operation leaves no route. That holds for get, post and the other HTTP
methods. For x-amazon-apigateway-any-method the REST importer fails
the stack instead, with "expected an Operation object", on main too
and without Auth.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): check no-default SAM REST bodies as SAM does

An Auth that selects no default, such as ApiKeyRequired: false alone,
returned once the DefinitionBody had a paths object. SAM checks more
for any non-empty Auth before it applies a default:
SwaggerEditor.is_valid wants a truthy swagger or an openapi version
3.x, and the SwaggerEditor constructor wants every paths entry, and
each branch of an Fn::If around one, to be an object. floci therefore
accepted a body without a version, a paths map written as Fn::If, or
a path item that is not an object, all of which SAM refuses. The
previous commit's message said SAM accepts such a paths map; it does
not.

These are now refused with a ValidationError when no default is
selected too. Nothing else is checked in that case, as in SAM: an
OpenAPI 3.1 body, a $ref path item, a nested Fn::If or a malformed
security requirement is left as written. SamTransformProcessor's
isTruthy helper, which already models SAM's truthiness, becomes
package-private so the check can share it.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): leave nested Fn::If operations as SAM does

With a default selected, an Fn::If around an operation whose branch
was itself an Fn::If failed the transform with "Auth does not support
a nested Fn::If in paths". SAM does not fail there. Its
iter_on_all_methods_for_path reads one level of Fn::If around an
operation and skips a method definition without an
x-amazon-apigateway-integration. It therefore leaves the nested
branch as written, adds the defaults only to the plain one, and the
template deploys on AWS.

Such a branch is now left as written, without the defaults, and the
plain branches still get them. A nested Fn::If around a path item is
still refused: SAM fails there too, once it reads the methods of the
inner Fn::If.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): share the SAM REST stack deploy in one helper

Three SamRestApiAuthIntegrationTest cases each created the stack,
waited for it, read its ApiId output and deleted it in a finally
block. withDeployedApi now does that once: it adds the ApiId output,
deploys the template, hands the API id to the assertions once the
stack is CREATE_COMPLETE, and deletes the stack in its finally. The
assertions are unchanged; a failed deploy now reports the stack's own
status reason in all three cases.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): keep the failed resource's reason in deploy failures

withDeployedApi reported only the stack's status reason when a stack
did not reach CREATE_COMPLETE. For a resource failure that is the
generic "The following resource(s) failed to create", where two of
its callers used to report the failed resource's own reason, such as
the importer's refusal. The helper now appends that reason when the
stack rolled back, and keeps the stack's reason alone for a transform
failure, which has no failed resource. Only failure messages change.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com>
2026-10-24 20:15:07 -04:00
Andre Kurait 922e36a472 feat(cloudwatch): support composite alarm lifecycle (#6408) 2026-10-24 17:54:21 -04:00
Jackson Price 9c6d6a0ce8 fix(cloudformation): append AutoPublishCodeSha256 to a SAM function's Description (#6364) 2026-10-24 17:44:13 -04:00
Mario Toffia deeb3b3075 fix(cloudformation): forward Firehose processing and logging configuration (#6277)
* feat(firehose): store and echo CloudWatchLoggingOptions on S3 destinations

CreateDeliveryStream and UpdateDestination silently dropped CloudWatchLoggingOptions because the S3 destination model had no such member. The block is now stored and echoed on both ExtendedS3DestinationDescription and S3DestinationDescription, defaulting to {"Enabled": false} when omitted, as real AWS does. UpdateDestination merges it member-wise, so an update naming only Enabled keeps the stored log group and stream.

* fix(cloudformation): forward Firehose processing and logging configuration

FirehoseCfnProvisioner now reads RoleARN, ErrorOutputPrefix, CloudWatchLoggingOptions and, for the extended S3 destination only, ProcessingConfiguration, resolving intrinsics before handing them to the service. A Lambda transform declared in a template therefore runs on delivery and is echoed by DescribeDeliveryStream, as on AWS. An omitted member stays null so an UpdateStack keeps the stored value, and an unreadable block fails the resource with ValidationError.

* test(cloudformation): cover a stack Firehose stream's Lambda transform end to end

A stack-created extended S3 stream now reads back its role, error prefix, logging options and
Lambda processor, runs that processor on delivery, and picks up a new function on UpdateStack.

* docs(firehose): describe logging options and the CloudFormation members applied

Document how CloudWatchLoggingOptions is stored, defaulted and merged on the S3 destinations, and note which DeliveryStream properties the CloudFormation provisioner applies.

* fix(cloudformation): validate a Firehose stream's forwarded destination like CreateDeliveryStream

The provisioner now runs the same wire-shape validation CreateDeliveryStream applies, so a bad processor or CompressionFormat fails the resource instead of being stored. A structured destination member present as anything but an object also fails rather than being silently dropped.

* docs(cloudformation): name every Firehose property the provisioner applies

* fix(firehose): validate CloudWatchLoggingOptions names against AWS constraints

LogGroupName and LogStreamName are now checked against AWS's 512-character bound and their modeled patterns, reporting both rules when both fail, as probed against real AWS.

* chore: retrigger CI after a transient npm publish race

native arm64 / sdk-test-node ran npm install between the publication of @aws-sdk/lib-storage 3.1156.0 and @aws-sdk/client-s3 3.1156.0, and failed with ERESOLVE.

* test(firehose): share the delivery and Lambda transform helpers in FirehoseRequests

Moves encode, putRecordBatch, firstKey and the record-id driven Lambda transform answer out of CloudFormationFirehoseIntegrationTest and FirehoseLambdaTransformIntegrationTest into one testing fixture both now use.

* fix(firehose): require both log names when CloudWatch logging is enabled

With Enabled true, a missing or empty LogGroupName or LogStreamName is now refused with AWS's InvalidArgumentException, group before stream, on the merged result for UpdateDestination and ahead of the other semantic checks, as probed against real AWS.

* fix(firehose): fill the defaults on a Redshift destination's S3 backup

Create and describe now apply the S3 defaults, including CloudWatchLoggingOptions Enabled false, to a Redshift destination's backup configuration as well as its intermediate one, so persisted streams heal on read.
2026-10-23 07:00:08 -04:00
Aniket Shukla 9e3413980e docs(cloudformation): explain HTTPS custom resource callbacks (#6279)
Document opt-in TLS and the default port 443 listener for packaged Node.js handlers that hard-code HTTPS callbacks. Preserve certificate verification and clarify the unchanged HTTP ResponseURL and inline module behavior.

Verify 51 existing focused callback, TLS-port, endpoint, and CA-bundle tests, Checkstyle, docs checks, 95 docs-tool tests, and the partition gate. No runtime code or configuration defaults change.
2026-10-22 16:16:57 -04:00
lex00 5beb8d47b9 fix(cloudformation): keep Route 53 routing policies and provision health checks (#6191)
A Route 53 RecordSet resource now writes Region, Failover, Weight and
HealthCheckId into the record, as ChangeResourceRecordSets stores them.

A HealthCheck resource creates a health check with its tags, and its Ref
and HealthCheckId attribute return the check's id. An unknown Type is
refused before any check is created. Changing Type, RequestInterval or
MeasureLatency replaces the check, and the old one is deleted once the
update commits, or kept under UpdateReplacePolicy: Retain. Any other
change updates the check in place, and a failed stack update puts back
its earlier settings and tags.
2026-10-21 23:09:42 -04:00
Jimmy Liu Jia a8e49fbbaa feat(cloudformation): support WAFv2 logging configuration (#6194)
* feat(cloudformation): support WAFv2 logging configuration

* fix(cloudformation): honor WAFv2 logging replacement and rollback
2026-10-21 21:23:13 -04:00
Alessandro Lattao a6433d521a fix(cloudformation): refuse a template body that does not parse (#6179)
* fix(cloudformation): refuse a template body that does not parse

ValidateTemplate answered success for a body that reads as neither JSON nor
YAML, since the null value check skipped a template it could not parse.
CloudFormation refuses such a body at the request, and so does Floci now, in
ValidateTemplate, CreateStack, UpdateStack, CreateChangeSet and
GetTemplateSummary, all measured with the same texts.

CloudFormation reads a body as YAML, of which JSON is a subset, so the new
CloudFormationTemplateParser tries strict JSON first (trailing tokens refused)
and falls back to the CF-aware YAML parser, which also reads JSON with a
trailing comma or unquoted keys, as AWS does. When both fail, a body that
starts with { and ends with } is "JSON not well-formed" at Jackson's position,
anything else "YAML not well-formed" at SnakeYAML's, both 1-based and taken
from the body as sent, so leading blank lines keep their line numbers. A body
that reads as a scalar or a list is "unsupported structure.".

Stack sets keep their null check skipping a body that does not parse, since
CreateStackSet was not measured with one. A template that reads but has no
Resources member is left as it was: that is a check of a template, not of
its format.

* fix(cloudformation): refuse a body that is no template in stack sets too

CreateStackSet and UpdateStackSet stored a body that does not parse, whose
instances then could not deploy: CreateStackInstances and UpdateStackSet
stopped halfway with the change set's 400. Measured on CloudFormation, both
refuse such a body before keeping it, with the same texts followed by the
service exception's details, as they refuse a null value, and an update
leaves the previous body in place. They now go through the same check as the
other operations, so a stored body always parses.

The JSON message also needs the body to start with {, not only to end with }:
[{"a": 1} is YAML not well-formed at line 1, column 10 on CloudFormation.
2026-10-21 16:02:31 -04:00
Alessandro Lattao 5fa67625c1 fix(cloudformation): refuse a template that holds a null value (#6071)
* fix(cloudformation): refuse a template that holds a null value

CloudFormation refuses a template with a null anywhere in it when
ValidateTemplate, CreateStack, UpdateStack or CreateChangeSet is
requested, before anything is created: 400 ValidationError
"[<path>] 'null' values are not allowed in templates". Floci accepted
such a template and provisioned it, so a template AWS rejects deployed
locally, and ValidateTemplate answered success without reading it.

The check runs where a change set is created, which CreateStack,
UpdateStack and CreateChangeSet share, and in ValidateTemplate. The
path is the one AWS names, measured on eu-west-1 on 2026-10-20: the
first null in document order, Type in place of a resource's Properties
below them, a null Properties named as is, list entries by index and
an intrinsic's arguments included. JSON null, YAML ~ and a YAML key
with no value are all null there.

A template that does not parse is left to the parser's error where it
is processed, as the other request-time checks do.

CognitoResourceServerCfnIntegrationTest's null Scopes cases sent such
a template and expected the resource to fail. They now expect the
request refused, as on AWS, and keep what they checked: no server is
created, and a refused update leaves the server as it was.

* fix(cloudformation): refuse null templates in stack sets and answer missing template objects

A review of the null-value check found four gaps, each measured on
CloudFormation (eu-west-1, 2026-10-20) before the fix.

- A template that is null as a whole ("null", "~", "---", a comment
  alone) parsed to no root
  and the check failed with a 500. AWS answers "Template format error:
  At least one Resources member must be defined.", which it does now.
- CreateStackSet and UpdateStackSet stored a null-valued template and
  only each instance's deployment refused it. AWS refuses the request
  and keeps the previous template, with CloudFormation's message
  followed by the service exception's details. Both now check the
  template they would keep before storing it or reserving an operation.
- ValidateTemplate reading TemplateURL reached the shared S3 fetch,
  whose failures were a 500, as they already were for CreateStack and
  GetTemplateSummary. A missing object or bucket now answers AWS's
  ValidationError texts for all three. AWS also refuses a URL that is
  not an S3 one; Floci keeps reading any host as S3, so a local URL can
  name Floci by whatever host reaches it.
- The compatibility test's cleanup swallowed every exception; DeleteStack
  of a stack that does not exist succeeds, so it no longer catches any.

CloudFormationS3VectorsTest and CloudFormationCognitoResourceServerTest
in sdk-test-java sent null values and expected them to reach the
resource. AWS refuses those templates when the operation is requested,
so the S3 Vectors cases that cannot be deployed there are dropped and
the Cognito update case now expects the request refused, with the
server left as it was.

* refactor(cloudformation): build the stack-set null refusal with sdkErrorMessage

A review pointed out that the suffix StackSets adds to CloudFormation's
message was built by hand while CloudFormationTemplateEngine.sdkErrorMessage
already builds it for this package, and that updateStackSet wrote the
template it would keep twice. The refusal now uses sdkErrorMessage, and
the kept template is one local both checks read; the answers are the
same.
2026-10-20 17:13:31 -04:00
Alessandro Lattao 95bf6df474 feat(dsql): add Aurora DSQL's control plane and AWS::DSQL::Cluster (#6048)
* feat(dsql): add Aurora DSQL's control plane and AWS::DSQL::Cluster

The first half of #6014. Aurora DSQL's REST JSON control plane, with
the answers measured on AWS (eu-west-1): CreateCluster, GetCluster,
ListClusters, UpdateCluster, DeleteCluster, GetVpcEndpointServiceName,
the cluster policy calls and tagging on cluster ARNs. Identifiers are 26
characters of lowercase base32 as DSQL's are, and malformed or unknown
ones are refused with DSQL's messages; a cluster created without
deletionProtectionEnabled is protected, and deleting a protected one is
refused. CreateCluster answers CREATING and the cluster is ACTIVE right
after.

AWS::DSQL::Cluster waits for ACTIVE, returns the identifier from Ref
and Identifier, ResourceArn, Status, CreationTime, Endpoint, VpcEndpoint
and VpcEndpointServiceName through Fn::GetAtt, and a protected cluster
makes the stack's deletion fail, as on AWS.

A cluster has no database behind it here: its endpoint is named as on
AWS, <id>.dsql.<region>.localhost.floci.io, but not served. Serving it
is the second half of #6014, its own pull request.

* fix(dsql): answer the control plane's edge cases as DSQL does

Review of #6048, each answer measured on DSQL (eu-west-1) first:
- ListClusters carries on from a page token whose cluster was deleted
  in between, as AWS does: the token now holds the sort position of the
  next page's first cluster rather than its identifier.
- deletionProtectionEnabled is read as DSQL reads it: text is false
  when it spells false in any case and true otherwise; empty text, a
  number, an object and a list fail with SerializationException.
- The tag calls refuse another account's cluster ARN with 403
  AccessDeniedException instead of reading it in the caller's account.
- A client token reused with other parameters answers 409
  ConflictException; with the same ones, the earlier cluster.
- AWS_OWNED_KMS_KEY names AWS's own key on create and update.

AWS::DSQL::Cluster reads DeletionProtectionEnabled and PolicyDocument
with AWS::NoValue as left out, and an update that drops the
multi-Region properties clears them, as it already reset the key and
deletion protection. ListTagsForResource copies the tags under the
cluster's lock, and a cluster's lock goes with the cluster.

* fix(dsql): answer errors, policies, updates and multi-Region clusters as DSQL does

A review asked for the attribute coverage, the reason ValidationException
carries, a real untag assertion and tests of the stack-update path.
Measuring them on DSQL (eu-west-1, 2026-10-20) found more that did not
match, fixed here too.

- Attributes are written with resource.getAttributes().put, which the
  schema coverage test reads; EncryptionDetails, an object an output
  refuses on AWS, is recorded as a gap.
- DSQL leaves reason out of its model-validation errors. Only the page
  token's refusal carries it, with fieldList naming next-token and its
  own text. maxResults no longer quotes the value.
- Tag calls answer what DSQL answers: 403 for an ARN that is not a
  cluster ARN, 400 BadRequestException for another Region's, 404
  NotFoundException for no cluster. The 403s name the caller.
- Policy versions are epoch milliseconds, DeleteClusterPolicy answers
  the deleted version, and the missing-policy and stale-version errors
  carry DSQL's texts and resourceType.
- Policies are checked and kept as DSQL does: its three refusal texts,
  a service principal, a principal that names no one, a public grant,
  and the lockout check when both policy actions are denied to the
  caller, unless bypassPolicyLockoutSafetyCheck. The kept form is
  Jackson's pretty printer in DSQL's element order, with condition
  operators and keys in HashMap order, as measured.
- The public check shares its condition keys with Lambda web functions
  through PublicAccessConditions, and S3 now takes its fixed-value and
  SourceIp range tests from there. Sharing the whole rule was tried and
  dropped: DSQL was measured to treat some operators otherwise than
  LambdaWeb's and S3's rules do (ForAnyValue:, ArnLike "*",
  StringEquals "*"), so the operator rules stay per service. The
  lockout check is IamPolicyEvaluator's.
- A multi-Region cluster is PENDING_SETUP and lists itself until it and
  each peer name one another, then ACTIVE; its deletion answers
  PENDING_DELETE.
- AWS::DSQL::Cluster reads its properties through CfnPropertyTypes, so
  a PolicyDocument object or DeletionProtectionEnabled "yes" fails as
  on AWS, where Boolean.valueOf made "yes" false. An update leaves a
  property the template no longer sets as it was, deletion protection,
  KMS key and multi-Region alike, and removes only the tags and the
  policy; an earlier change put them back to their defaults, which was
  not measured and is not what CloudFormation does. A policy the
  template does not change keeps its version, and create settles on
  PENDING_SETUP too.

DsqlServiceTest, DsqlClusterPoliciesTest and DsqlCfnProvisionerTest
cover these in isolation, the integration tests over the wire.

* fix(dsql): keep the public access rule to DSQL and forget a deleted policy's version

A review asked to leave S3 and Lambda web functions out of this change,
and pointed at DSQL's own block public access page. The shared helper
is dropped and S3 and Lambda web functions are as on main; folding
their copies into one helper belongs to a separate change.

DSQL now has its own keys: the trusted ones its page lists, and
aws:SourceIp, aws:SourceVpcArn and the three aws:Vpce* keys, which the
page leaves out but DSQL accepts (measured, eu-west-1, 2026-10-20). As
the page says, a policy variable never restricts: StringEquals with
${aws:PrincipalArn}, ${aws:SourceVpc} or a role/${aws:username} ARN is
public on DSQL. ArnEquals reads like ArnLike, as IAM matches both the
same way, so a value that is no ARN, ${aws:SourceArn} among them,
matches nothing and restricts, as measured.

DeleteClusterPolicy left the deleted version on the cluster, so a put
naming it went through; it is now cleared, and a put that names a
version on a cluster with no policy is refused as not found.
2026-10-20 15:34:39 -04:00
Andre Kurait 0517a7a936 fix(cloudformation): enforce SAM REST authorization defaults (#6021)
Signed-off-by: Andre Kurait <akurait@amazon.com>
2026-10-19 21:32:03 -04:00
andrehoong-px 5774e7db8d feat(cloudformation): support S3 Vectors resources (#5853)
* feat(cloudformation): support S3 Vectors resources

* fix(cloudformation): validate S3 Vectors encryption settings

* fix(cloudformation): align S3 Vectors provisioning contracts

* fix(cloudformation): restore S3 Vectors properties on rollback
2026-10-19 18:16:10 -04:00
Alessandro Lattao fcb41966a8 fix(cloudformation): read an ECS task definition's properties as the ECS handler does (#6018)
Measured on CloudFormation (eu-west-1): an AWS::ECS::TaskDefinition gets
no template validation. CloudFormation hands the ECS handler every
scalar as text, and the handler converts each to the type the resource
schema declares: an integer is a sign and digits once trimmed, within
32 bits ("+128", " 128", "0128"), and a boolean is true or false in
lower, upper or title case once trimmed. A value it cannot convert
("abc", 4.5 or true for an integer, "yes", "tRuE" or "1" for a
boolean), and an object, a list and a scalar standing for one another,
fail the resource with every violation of the unconverted model, where
every scalar is a String, so a Memory of 128 is listed beside the value
that failed. At each object its missing required members come first,
then its members in the schema's order. When every value converts, the
required members the model lacks fail it alone, grouped where their
paths meet as the schema validator groups them.

Floci read the properties as plain JSON: a Memory of "abc" and a
container without an image were registered, and an Essential of
"False" registered an essential container.

AWS::ECS::TaskDefinition joins the generated cfn-property-types.json,
whose structures now carry the members the schema requires, read into
RequestShapeModel's shapes. CfnPropertyTypes' walk over the shapes is
shared by the template validation Reader and the new HandlerReader,
which differ in how a scalar converts and in what a mismatch does.
2026-10-19 16:15:05 -04:00
Jackson Price 9099cec5e8 fix(cloudformation): check S3 ownership rules against the resource schema (#5834)
* fix(cloudformation): check S3 ownership rules against the resource schema

#5712 made AWS::S3::Bucket apply OwnershipControls, with the
provisioner answering a wrong type and a rule without ObjectOwnership,
and S3 answering two rules, no rule and an unknown mode with
MalformedXML. Two constraints of AWS's published resource schema were
still missing. A key the schema does not define was dropped unread: next
to a valid rule the stack reached CREATE_COMPLETE, and a misspelt
ObjectOwnership was reported as missing. A rule listed twice was
refused by S3 for the rule count, not by the schema for the repeat.

Both now fail the resource before the bucket is created or changed, in
the provisioner's "Model validation failed (#/OwnershipControls...)"
form: "extraneous key [<key>] is not permitted" on OwnershipControls and
on each rule, and "array items are not unique" on Rules, compared once
intrinsic functions are resolved. Every other case keeps #5712's
answer: two different rules, no rule and an unknown mode still get
MalformedXML, and a rule without ObjectOwnership still reports the
missing key. Its type checks get tests for the shapes it did not cover.

docs/services/cloudformation.md gains an S3 ownership controls section.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* fix(cloudformation): check each ownership rule before the repeat

The uniqueness check ran before each rule's own checks, so a repeated
rule that is malformed by itself, such as {"Rules": [{}, {}]} or two
string rules, was refused as "array items are not unique" rather than
for its own fault, which is the answer #5712 gives the same rule alone.
The repeat is now checked once every rule passes on its own, still
before S3's rule count.

Tests now pin the order and the key each level allows: an extra key
beside a Rules of the wrong type, ObjectOwnership on OwnershipControls,
Rules on a rule, and a repeat that is not adjacent. The update test
checks the error it gets.

The previous commit's "Every other case keeps #5712's answer" holds
from this commit on. Where the schema and S3 disagree, a missing Rules
key and a mode outside the enum still get S3's MalformedXML.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): correct the S3 ownership controls section

Say which key each level allows, that S3 rather than the resource
schema requires ObjectOwnership, and that a repeated rule is checked
once every rule passes its own checks. Name the two cases, a missing
Rules and a mode outside the enum, where Floci keeps S3's answer and
the schema would refuse the template itself. Describe the reason a
stack reports rather than error codes it never shows, and flatten the
nested list, which Python-Markdown renders as siblings at a two-space
indent.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* test(cloudformation): pin the repeat check after every ownership rule

A repeat ahead of a malformed rule, as in [A, A, {}], must still fail
for the third rule's missing ObjectOwnership, as a single malformed
rule does. Without this row, checking each rule against the earlier
ones inside the rule loop passed every test.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

* docs(cloudformation): say S3 ownership rules are checked in turn

The section said that what the resource schema refuses is reported
first. The provisioner checks each rule in turn, so a rule without
ObjectOwnership, which only S3 requires, is reported ahead of a schema
fault in a later rule. Give the order the checks run in, and say that
CloudFormation's reason can differ for such a rule, since the schema
accepts it.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>

---------

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
2026-10-18 21:32:06 -04:00
Matheus Oliveira a57c20943a feat(cloudformation): provision AWS::WAFv2::IPSet (#5950)
* feat(cloudformation): provision AWS::WAFv2::IPSet

Serve AWS::WAFv2::IPSet from WafV2CfnProvisioner instead of the
dispatcher stub, so stacks with IP sets no longer fail in strict mode
and Web ACL rules can resolve a real IP set ARN.

Name and Scope are create-only: a change replaces the set with a new
name|id|scope physical id (Ref) and deletes the prior one the same way
a Web ACL replacement does, tolerating a cleanup failure so the new set
is still tracked. Addresses, Description and Tags update in place
through UpdateIPSet; IPAddressVersion is never passed to the update,
matching the real API, so a template that flips it fails address
validation and reports UPDATE_FAILED. Fn::GetAtt resolves Arn and Id
from the backing set, and DeleteStack removes it, tolerating a set
already gone.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* fix(cloudformation): defer IPSet replacement cleanup and honor its optional name

Review follow-ups on the AWS::WAFv2::IPSet provisioner:

- A renamed or re-scoped set now records the displaced one with
  ReplacementCleanup, so a failing delete of the prior set is reported
  by completeUpdate instead of being tolerated, and rollbackUpdate
  restores the prior set and deletes the replacement, the same contract
  the S3 bucket replacement follows.
- IPAddressVersion is validated against IPV4/IPV6 on every provision.
  An in-place update never sends it to UpdateIPSet, so an unknown value
  would otherwise be accepted without ever reaching WAFv2.
- Name is optional in the CloudFormation schema, matching what the Web
  ACL arm in the same provisioner already does: an omitted Name
  generates one on a create and reuses the existing set's name on an
  update.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

* fix(cloudformation): mark AWS::WAFv2::IPSet Name and Scope create-only

Name and Scope are create-only in the registry schema, so without an entry
in create-only-properties.json a Scope change fell to the name-based
default and showed Replacement: False in the change set. A resource that
reads the set's Ref or Arn was then skipped by the update and kept the ARN
of the set that replacement cleanup deletes.

Also share the IPV4/IPV6 rule between the provisioner and
WafV2Service.validateAddresses, which repeated it, so an unknown
IPAddressVersion is rejected in one place.

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>

---------

Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
2026-10-18 20:32:42 -04:00