aws-cloudformation / cfn-lint

CloudFormation Linter
MIT No Attribution
2.43k stars 590 forks source link

v1: E2001 'AllowedPattern' is not one of ['AllowedValues', ...] (for type AWS::SSM::Parameter::Value<String>) #3328

Closed cbernander closed 3 months ago

cbernander commented 3 months ago

CloudFormation Lint Version

1.3.0

What operating system are you using?

Ubuntu

Describe the bug

cfn-lint does not accept the AllowedPattern property for a Parameter of type AWS::SSM::Parameter::Value<String>:

E2001 'AllowedPattern' is not one of ['AllowedValues', 'ConstraintDescription', 'Default', 'Description', 'MaxLength', 'MinLength', 'NoEcho', 'Type']

Expected behavior

cfn-lint should accept the AllowedPattern property for a Parameter of type AWS::SSM::Parameter::Value<String> (i.e. treat it the same way as a regular String Parameter type).

Reproduction template

---
AWSTemplateFormatVersion: "2010-09-09"
Description: >
  Basic Template
Parameters:
  BillingContact:
    Type: AWS::SSM::Parameter::Value<String>
    Default: /contacts/billing-contact
    AllowedPattern: '^/contacts/.*-contact$'
Resources:
  myInstance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: ami-2f726546
      Tags:
      -
        Key: billing_contact
        Value: !Ref BillingContact
cbernander commented 3 months ago

I think the trivial fix for this might be to add AllowedPattern to this enum ? https://github.com/aws-cloudformation/cfn-lint/blob/4e96246b83c74fc18a61bab51fd045f9c12787dc/src/cfnlint/data/schemas/other/parameters/configuration.json#L159-L168

kddejong commented 3 months ago

Fix will be in the next release today.