cloudformation-coverage-roadmap icon indicating copy to clipboard operation
cloudformation-coverage-roadmap copied to clipboard

ServerlessCacheName to optional

Open tcaesvk opened this issue 2 years ago • 1 comments

Name of the resource

Other

Resource name

AWS::ElastiCache::ServerlessCache

Description

AWS::ElastiCache::ServerlessCache.ServerlessCacheName is required property. Hope the property to optional and AWS CloudFormation generates a unique physical ID when not specified as AWS::ElastiCache::CacheCluster.ClusterName and AWS::ElastiCache::ReplicationGroup.ReplicationGroupId.

Other Details

No response

tcaesvk avatar Jan 02 '24 05:01 tcaesvk

To clarify the above.

From CDK docs:

Assigning physical names to resources has some disadvantages in AWS CloudFormation. Most importantly, any changes to deployed resources that require a resource replacement, such as changes to a resource's properties that are immutable after creation, will fail if a resource has a physical name assigned. If you end up in that state, the only solution is to delete the AWS CloudFormation stack, then deploy the AWS CDK app again. See the AWS CloudFormation documentation for details.

To summarize, it is usually not a good idea to assign a "physical name" to a resource. In fact, I believe it is considered an anti-pattern (also see CDK best-practices).

However, the ElastiCache serverlessCacheName property is required, so we are forced to assign a physical name to a ServerlessCache resource.

As a result, deployments that try to update the ServerlessCache resource will fail.

dennisvang avatar Aug 16 '24 19:08 dennisvang