Cloudformation: !ref a list of key/value pairs (i.e. CWM namespaces)

Viewed 111

I'm getting stuck on this issue. Essentially I want to output the list of 'Namespace' key/values like below:

MyCloudWatchMetricStream:
    Type: AWS::CloudWatch::MetricStream
    Properties:
      IncludeFilters:
        - Namespace: AWS/ELB
        - Namespace: AWS/Events
        - Namespace: AWS/Logs

When it's declared like this:

MyCWMIncludeFilters:
  Type: String
  Default: 'Namespace: AWS/ELB,Namespace: AWS/Events,Namespace: AWS/Logs'

I've tried this to no avail:

MyCloudWatchMetricStream:
    Type: AWS::CloudWatch::MetricStream
    Properties:
      IncludeFilters: !Split [",", !Ref MyCWMIncludeFilters]

and getting this error on stack creation:

Embedded stack arn:aws:cloudformation:<redacted> was not successfully created: 
The following resource(s) failed to create: [MyCloudWatchMetricStream]. 

Any ideas of what I can do? Alternatives? Best practices?

Thanks in advance!

0 Answers
Related