Why does Deployment resource get unique name each time?

As of this commit each Deployment get a unique, timestamped name
(DeploymentApigEvent${(new Date).getTime().toString()}).

I’m writing a plugin to add support for API Gateway caching, and that behaviour triggers a bug(?) in CloudFormation where one Deployment cannot modify another’s StageDescription (more info in this thread for those interested).

Why were the Deployments given unique/timestamped names? What would happen if I reverted them back to a non-unique value? Are there any side-effects for Serverless or AWS I’m not aware of?

I’m no expert but the originating PullRequest says that it’s to force CloudFormation to see that something is changed:

Adds a unique timestamp token to the APIG deployment logical id to prompt AWS CF to restart deployment.

https://github.com/serverless/serverless/pull/1761

1 Like

Hi @svrist

Thanks for pointing me to the PR. It would be nice to get a bit more details about what was the issue this was trying to fix. It obviously works (as far as I can tell) with non-unique logical resource name.