aws-cloudformation / cloudformation-coverage-roadmap

The AWS CloudFormation Public Coverage Roadmap
https://aws.amazon.com/cloudformation/
Creative Commons Attribution Share Alike 4.0 International
1.11k stars 54 forks source link

ServerlessCacheName to optional #1880

Open tcaesvk opened 8 months ago

tcaesvk commented 8 months ago

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

dennisvang commented 3 weeks ago

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.