mirror of
https://github.com/floci-io/floci.git
synced 2026-11-28 08:09:43 -05:00
* fix(apigateway): create API keys disabled unless enabled is set AWS creates an API Gateway API key disabled when the CreateApiKey request has no enabled field, and the AWS::ApiGateway::ApiKey CloudFormation schema declares Enabled with a default of false. Floci created such keys enabled, and a CloudFormation update whose template omitted Enabled switched the key on. AWS SDKs that model enabled as a plain boolean, such as the AWS SDK for Go v2, leave the field out of the request when it is false, so a client asking for a disabled key received an enabled one. * fix(cloudformation): restore an API key when its stack update rolls back When a stack update changed an AWS::ApiGateway::ApiKey and a later resource in the same update failed, the stack ended in UPDATE_ROLLBACK_FAILED and the key kept the new customer id, description, enabled flag and tags. The provisioner had no rollback. The provisioner now records those four values on the stack resource before it changes the key, and puts them back when the stack update rolls back. It also replaces the tags before patching the other fields, so a refused tag change leaves the key untouched. * fix(cloudformation): delete an API key an update recreated when the update rolls back When a stack update found that its API key had been deleted outside CloudFormation, it created a new key. If a later resource then failed the update, the rollback reported success and left the new key live, while the stack resource still named it. The update now records the key it created, and the rollback deletes that key and points the stack resource back at the previous key id. The API key CloudFormation integration test now waits for the stack to reach a final status before checking it, because stack create and update run in the background. * fix(cloudformation): put an API key's tags back when its own update fails An API key update replaces the tags first and then patches the other fields. If the patch failed after the tags were replaced, the stack rolled back but the key kept the new tags. For a resource whose own update fails, the stack restores the stored resource record and does not call the provisioner's rollback, so nothing put the tags back. The update now copies the tags before replacing them and puts the copy back when the patch fails, then rethrows the original error. * fix(cloudformation): undo the whole API key when its own update fails An API key update replaces the tags and then patches the customer id, description and enabled flag. Either call can fail after it has already changed the stored key. Before, a failure only put the tags back, and a failure to put them back was hidden, so the stack could report a clean rollback while the key kept the failed update's values. Now any failure in either call puts the key's four values back from the snapshot taken before the update. If that restore also fails, the resource is marked so the stack ends in UPDATE_ROLLBACK_FAILED, and the original error is rethrown with the restore error attached. * fix(cloudformation): roll an API key back by writing only what changed Rolling back an API key update wrote every saved value back, even when the update had changed nothing. For example, the service refuses a reserved tag change before it writes anything, yet the rollback still rewrote the tags and fields. That changed the key's last-updated time for no reason, and if one of those writes failed, the stack reported UPDATE_ROLLBACK_FAILED for an update that had not changed the key. The rollback now reads the key as it is and writes back only the tags and fields that differ from the saved values. The update and the rollback share one function to decide which fields differ. Also, when the rollback fails with the same exception object as the update, it is no longer attached to itself, which threw an IllegalArgumentException and hid the original error. * fix(cloudformation): put back a reserved API key tag when an update rolls back An API key can be created with a reserved tag, such as the id-override tag _custom_id_. A stack update may remove that tag. When a later resource failed the update, the rollback tried to put the tag back through the same call the update uses, which refuses a reserved tag that is being added. The stack then ended in UPDATE_ROLLBACK_FAILED and the key stayed without its tag. The API Gateway service gains a call that sets a key's tags exactly as given, without the reserved-tag check. The rollback uses it. Tag changes from a template still go through the checked call. The test helper that applies patches now uses a switch expression, as the repository's code style asks.