I have 1 x AWS ElastiCache Replication Group running Redis built using CloudFormation.
I have a CloudFormation Output as follows:
ElastiCacheRedisReplicationGroupReaderEndPoints:
Description: The reader endpoints for ElastiCache
Value:
Fn::GetAtt: ElastiCacheRedisReplicationGroup.ReadEndPoint.Addresses
Export:
Name:
Fn::Sub: ${AWS::StackName}-ReadEndpoints
The Output value is:
[redis-replication-group-001-001.******.0001.euw2.cache.amazonaws.com]
In another CloudFormation template I was hoping to use the Output value as the Collection within a Fn::ForEach intrinsic function to create CloudWatch Alarms like so:
Fn::ForEach::ElastiCacheCPUUtilizationAlarms:
- ReadEndpoint
- Fn::ImportValue:
Fn::Sub: ${ElastiCacheStackName}-ReadEndPoints
- ElastiCacheCPUUtilizationAlarm&{ReadEndpoint}:
Type: AWS::CloudWatch::Alarm
...(truncated)
When I update the CloudFormation stack I get an error:
Transform AWS::LanguageExtensions failed with: Could not find a collection or could not be resolved for Fn::ForEach
However if I explicitly set the collection like this, it works:
Fn::ForEach::ElastiCacheCPUUtilizationAlarms:
- ReadEndpoint
- - redis-replication-group-001-001.******.0001.euw2.cache.amazonaws.com:6379
- ElastiCacheCPUUtilizationAlarm&{ReadEndpoint}:
Type: AWS::CloudWatch::Alarm
...(truncated)
Is it the square brackets causing the problem? I don't understand why it can't see the imported value as a single value like when I explicitly define it.