Allow to specify Redis cluster name when using RedisNode component
inikolaev opened this issue · comments
Right now when using RedisNode
component to create Redis instance cluster name is set to the name of the resource section where component is declared:
SenzaComponents:
- Configuration:
Type: Senza::StupsAutoConfiguration
- Redis:
Type: Senza::RedisNode
CacheNodeType: "{{Arguments.InstanceType}}"
CacheParameterGroupName: "{{Arguments.RedisParameterGroupName}}"
EngineVersion: "{{Arguments.RedisVersion}}"
SecurityGroups:
- Fn::GetAtt: ["RedisSecurityGroup", GroupId]
The above definition will create a cluster named redis
.
While it's possible to use mustache templates to name a section I don't particulary like that approach as it hurts readability in my opinion.
I would like to propose to support ClusterName
attribute which would allow to set cluster name, For compatibility it will fallback to using section name. After that change the template will look like this:
SenzaComponents:
- Configuration:
Type: Senza::StupsAutoConfiguration
- Redis:
Type: Senza::RedisNode
CacheNodeType: "{{Arguments.InstanceType}}"
CacheParameterGroupName: "{{Arguments.RedisParameterGroupName}}"
ClusterName: "{{Arguments.Environment}}-redis-{{Arguments.ClusterName}}"
EngineVersion: "{{Arguments.RedisVersion}}"
SecurityGroups:
- Fn::GetAtt: ["RedisSecurityGroup", GroupId]
I will provide a PR for this ticket shortly.