1 Answer
- Newest
- Most votes
- Most comments
2
If you have colons : in the replacement value used as the logical ID of the resource, you should use the syntax &{variable} instead of ${variable} to reference it. That will deal properly with non-alphanumeric characters: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-foreach.html#intrinsic-function-reference-foreach-parameters
Resources: Fn::ForEach::ScalableTargets: - NeptuneCluster - !Ref ListOfNeptuneCluster - ScalableTarget&{NeptuneCluster}: Type: AWS::ApplicationAutoScaling::ScalableTarget Properties: MaxCapacity: 1 MinCapacity: 1 ResourceId: !Ref NeptuneCluster RoleARN: <role-arn> ScalableDimension: neptune:cluster:ReadReplicaCount ServiceNamespace: neptune
Relevant content
- AWS OFFICIALUpdated 3 years ago

This answer is super useful! Thank you Leo K