Skip to content

Commit 2cd1dac

Browse files
fatbasstardcmmeyer
authored andcommitted
Update rule documentation (aws-cloudformation#712)
1 parent 8707ab8 commit 2cd1dac

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

docs/cfn-resource-specification.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,9 @@ The Properties rule ([`E3002`](/docs/rules.md#E3002)) checks if the basic proper
1919

2020
### AllowedValue
2121
There are properties that need to specified with a specific enumerator, like the [Lambda Runtime](https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-Runtime). This information is not part of the default Specification.
22-
The linter extends the specification with these allowed values. The AllowedValue rule ([E3030](/docs/rules.md#E3030)) checks if specified values contain allowed values.
22+
The linter extends the specification with these allowed values. The AllowedValue rule ([E3030](/docs/rules.md#E3030)) checks if specified values contain allowed values.
23+
24+
### AllowedPattern
25+
There are properties that are restricted with a pattern ([Regular Expression](https://en.wikipedia.org/wiki/Regular_expression)), like the [Cognito Userpool EmailVerificationMessage](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateUserPool.html#CognitoUserPools-CreateUserPool-request-EmailVerificationMessage). This information is not part of the default specification.
26+
The Linter extends the specification with these patterns in a generic rule. The AllowedPattern rule ([E3031](/docs/rules.md#E3031)) checks if specific values adhere to the specified regex.
27+
*Since regular expression can be complex to read, the rules also supports the specification of a "human readable" value that is used in the error message*

docs/rules.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Rule `E3012` is used to check the types for value of a resource property. A num
2929

3030

3131
## Rules
32-
The following **104** rules are applied by this linter:
32+
The following **106** rules are applied by this linter:
3333

3434
| Rule ID | Title | Description | Source | Tags |
3535
| -------- | ----- | ----------- | ------ | ---- |
@@ -72,7 +72,7 @@ The following **104** rules are applied by this linter:
7272
| E2506 <a name="E2506"></a> | Resource EC2 Security Group Ingress Properties | See if EC2 Security Group Ingress Properties are set correctly. Check that "SourceSecurityGroupId" or "SourceSecurityGroupName" are are exclusive and using the type of Ref or GetAtt | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html) | `resources`,`securitygroup` |
7373
| E2507 <a name="E2507"></a> | Check if IAM Policies are properly configured | See if there elements inside an IAM policy are correct | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html) | `properties`,`iam` |
7474
| E2508 <a name="E2508"></a> | Check IAM resource limits | See if IAM resources do not breach limits | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) | `resources`,`iam` |
75-
| E2509 <a name="E2509"></a> | Validate SecurityGroup description | Check if SecurityGroup descriptions are correctly configured | [Source](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html) | `resources`,`securitygroup` |
75+
| E2509 <a name="E2509"></a> | Validate SecurityGroup description length | Check if SecurityGroup descriptions are not longer that 255 characters | [Source](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html) | `resources`,`securitygroup` |
7676
| E2510 <a name="E2510"></a> | Resource EC2 PropertiesEc2Subnet Properties | See if EC2 Subnet Properties are set correctly | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html) | `properties`,`subnet` |
7777
| E2520 <a name="E2520"></a> | Check Properties that are mutually exclusive | Making sure CloudFormation properties that are exclusive are not defined | [Source](https://github.com/aws-cloudformation/cfn-python-lint) | `resources` |
7878
| E2521 <a name="E2521"></a> | Check Properties that are required together | Make sure CloudFormation resource properties are included together when required | [Source](https://github.com/aws-cloudformation/cfn-python-lint) | `resources` |
@@ -97,9 +97,11 @@ The following **104** rules are applied by this linter:
9797
| E3020 <a name="E3020"></a> | Validate Route53 RecordSets | Check if all RecordSets are correctly configured | [Source](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html) | `resources`,`route53`,`record_set` |
9898
| E3021 <a name="E3021"></a> | Check Events Rule Targets are less than or equal to 5 | CloudWatch Events Rule can only support up to 5 targets | [Source](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/cloudwatch_limits_cwe.html) | `resources`,`events` |
9999
| E3022 <a name="E3022"></a> | Resource SubnetRouteTableAssociation Properties | Validate there is only one SubnetRouteTableAssociation per subnet | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html) | `resources`,`subnet`,`route table` |
100+
| E3023 <a name="E3023"></a> | Validate that AlarmIdentifier is specified when using CloudWatch Metrics | When using a CloudWatch Metric for Route53 Health Checks you must also specify the AlarmIdentifier | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-alarmidentifier) | `resources`,`route53`,`alarm_identifier` |
100101
| E3024 <a name="E3024"></a> | Validate that ProvisionedThroughput is not specified with BillingMode PAY_PER_REQUEST | When using ProvisionedThroughput with BillingMode PAY_PER_REQUEST will result in BillingMode being changed to PROVISIONED | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html) | `resources`,`dynamodb`,`provisioned_throughput`,`billing_mode` |
101102
| E3025 <a name="E3025"></a> | RDS instance type is compatible with the RDS type | Check the RDS instance types are supported by the type of RDS engine. Only if the values are strings will this be checked. | [Source](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html) | `resources`,`rds` |
102103
| E3030 <a name="E3030"></a> | Check if properties have a valid value | Check if properties have a valid value in case of an enumator | [Source](https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/cfn-resource-specification.md#allowedvalue) | `resources`,`property`,`allowed value` |
104+
| E3031 <a name="E3031"></a> | Check if property values adhere to a specific pattern | Check if properties have a valid value in case of a pattern (Regular Expression) | [Source](https://github.com/awslabs/cfn-python-lint/blob/master/docs/cfn-resource-specification.md#allowedpattern) | `resources`,`property`,`allowed pattern`,`regex` |
103105
| E3035 <a name="E3035"></a> | Check DeletionPolicy values for Resources | Check that the DeletionPolicy values are valid | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html) | `resources`,`deletionpolicy` |
104106
| E3036 <a name="E3036"></a> | Check UpdateReplacePolicy values for Resources | Check that the UpdateReplacePolicy values are valid | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html) | `resources`,`updatereplacepolicy` |
105107
| E4001 <a name="E4001"></a> | Metadata Interface have appropriate properties | Metadata Interface properties are properly configured | [Source](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-interface.html) | `metadata` |

src/cfnlint/rules/resources/properties/AllowedPattern.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
class AllowedPattern(CloudFormationLintRule):
2626
"""Check if properties have a valid value"""
2727
id = 'E3031'
28-
shortdesc = 'Check if properties have a valid value'
29-
description = 'Check if properties have a valid value in case of an enumator'
30-
source_url = 'https://github.com/awslabs/cfn-python-lint/blob/master/docs/cfn-resource-specification.md#allowedvalue'
31-
tags = ['resources', 'property', 'allowed value']
28+
shortdesc = 'Check if property values adhere to a specific pattern'
29+
description = 'Check if properties have a valid value in case of a pattern (Regular Expression)'
30+
source_url = 'https://github.com/awslabs/cfn-python-lint/blob/master/docs/cfn-resource-specification.md#allowedpattern'
31+
tags = ['resources', 'property', 'allowed pattern', 'regex']
3232

3333
def initialize(self, cfn):
3434
"""Initialize the rule"""

0 commit comments

Comments
 (0)