Sadly you can't do this automatically using plain CloudFormation just by having SomeRule1,SomeRule2
, because ExcludedRule is not a simple list of strings. It is list of objects, in the form of:
ExcludedRules:
- Name: SomeRule1
- Name: SomeRule2
Generation of such a list of objects would require some looping mechanism which is not supported in CloudFormation. You have to explicitly list all these rules, one by one.
But if you really must automate such process, you could develop a CloudFormation macro which would give you the ability to loop and construct such structures. Custom resources can also be used to automate such operations.
Both the macro and the custom resource would require you to develop a special lambda function which would perform the looping based on your SomeRule1,SomeRule2
and construct valid ExcludedRules
.