Open tchia04 opened 7 years ago
Thanks, this makes sense as S3 Buckets are a common resource to use.
I think a custom attribute checker would be needed to allow this functionality to be expanded to different types. Probably another JSON file which specifies the type name, in this case AWS::S3::Bucket.BucketName
with the validation rules and messages to test/show. Then a small bit of code which uses this JSON to run the validations at validate
time.
For reference, the limitation of buckets is at: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-name
I was wondering about a JS file instead of a JSON file, that way we could just write arbitrary validation functions. (this one is also something I've been wondering about).
This template will fail with the message "Bucket name should not contain uppercase characters "
However cfn-lint is not able to catch this. $ cfn-lint validate s3bucket_parameter.yaml 0 infos 0 warn 0 crit Template valid!