Skip to content

Commit

Permalink
Update regex pattern for rule I3042 (#3572)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong authored Aug 5, 2024
1 parent d4d7e2b commit de871c3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cfnlint/rules/resources/HardCodedArnProperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ class HardCodedArnProperties(CloudFormationLintRule):
)
source_url = ""
tags = ["resources"]
# using \r\n inside ${ } because there can be spaces in the sub parameter naming
# using \s for matching outside of Sub parameters as no space will work
regex = re.compile(
r"arn:(\$\{[^:]*::[^:]*}|[^:]*):[^:]+:(\$\{[^:]*::[^:]*}|[^:]*):(\$\{[^:]*::[^:]*}|[^:]*)"
r"arn:(\$\{[^:\r\n]*::[^:\r\n]*}|[^:\s]*):[^:\s]+:(\$\{[^:\r\n]*::[^:\r\n]*}|[^:\s]*):(\$\{[^:\r\n]*::[^:\r\n]*}|[^:\s]*)"
)

def __init__(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Parameters:
DynamoDBTableArn:
Description: "DynamoDB Table ARN"
Type: String
Resources:
S3BadBucket:
Type: AWS::S3::Bucket
Expand Down Expand Up @@ -78,3 +82,25 @@ Resources:
- !Sub arn:${AWS::Partition}:sns:${AWS::Partition}:${AWS::AccountId}:TestTopic
Roles:
- !Ref SampleRole

IngestionPipeline:
Type: AWS::OSIS::Pipeline
Properties:
PipelineName: mypipeline
MaxUnits: 1
MinUnits: 1
PipelineConfigurationBody: !Sub |
version: "2"
dynamodb-pipeline:
source:
dynamodb:
acknowledgments: true
tables:
- table_arn: ${DynamoDBTableArn}
- export:
s3_bucket: mybucket
s3_prefix: prod
stream:
start_position: "LATEST"
aws:
region: us-east-1

0 comments on commit de871c3

Please sign in to comment.