Skip to content

Commit ab1d699

Browse files
authored
fix: update cfn-lint versions and match tests (#3651)
1 parent 119e2a2 commit ab1d699

30 files changed

+142
-66
lines changed

.cfnlintrc.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,12 @@ ignore_templates:
134134
- tests/translator/output/**/function_with_tracing.json # Obsolete DependsOn on resource
135135
- tests/translator/output/**/api_with_propagate_tags.json # TODO: Intentional error transform tests. Will be updated.
136136
- tests/translator/output/**/function_with_intrinsics_resource_attribute.json # CFN now supports intrinsics in DeletionPolicy
137+
- tests/translator/output/**/function_with_snapstart.json # Snapstart intentionally not attached to a lambda version which causes lint issues
138+
- tests/translator/output/**/managed_policies_everything.json # intentionally contains wrong arns
137139
ignore_checks:
138140
- E2531 # Deprecated runtime; not relevant for transform tests
141+
- E2533 # Another deprecated runtime; not relevant for transform tests
139142
- W2531 # EOL runtime; not relevant for transform tests
140143
- E3001 # Invalid or unsupported Type; common in transform tests since they focus on SAM resources
141144
- W2001 # Parameter not used
145+
- E3006 # Resource type check; we have some Foo Bar resources

bin/run_cfn_lint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ ! -d "${VENV}" ]; then
99
python3 -m venv "${VENV}"
1010
fi
1111

12-
"${VENV}/bin/python" -m pip install cfn-lint==0.75.0 --upgrade --quiet
12+
"${VENV}/bin/python" -m pip install cfn-lint --upgrade --quiet
1313
# update cfn schema
1414
"${VENV}/bin/cfn-lint" -u
1515
"${VENV}/bin/cfn-lint" --format parseable

tests/translator/input/all_policy_templates.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Resources:
170170
EventBusName: name
171171

172172
- AcmGetCertificatePolicy:
173-
CertificateArn: arn
173+
CertificateArn: arn:aws:acm:us-west-2:987654321098:certificate/dec86919-7219-4e8d-8871-7f1609df2c7f
174174

175175
- Route53ChangeResourceRecordSetsPolicy:
176176
HostedZoneId: test

tests/translator/input/connector_with_non_id_source_and_destination.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Resources:
1111
Principal:
1212
Service: lambda.amazonaws.com
1313
ManagedPolicyArns:
14-
- arn:{AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
14+
- !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
1515

1616
SamFunction:
1717
Type: AWS::Serverless::Function

tests/translator/input/embedded_connectors_hardcoded_props.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ Transform: AWS::Serverless-2016-10-31
22
Resources:
33
MyFunction:
44
Type: AWS::Lambda::Function
5+
Properties:
6+
Handler: index.handler
7+
Role: arn:aws:iam::111122223333:role/lambda-role
8+
Runtime: nodejs20.x
9+
Code:
10+
ZipFile: |
11+
exports.handler = function(event, context, callback) {
12+
return callback(null, 'success');
13+
}
514
615
MyRule:
716
Type: AWS::Events::Rule
@@ -13,6 +22,8 @@ Resources:
1322
Arn: !Ref MyTopic
1423
Permissions:
1524
- Write
25+
Properties:
26+
ScheduleExpression: rate(5 minutes)
1627

1728
MyQueue:
1829
Type: AWS::SQS::Queue
@@ -42,6 +53,8 @@ Resources:
4253
Id: MyFunction
4354
Permissions:
4455
- Write
56+
Properties:
57+
Name: MyApiV1
4558

4659
MyApiV2:
4760
Type: AWS::ApiGatewayV2::Api
@@ -54,6 +67,8 @@ Resources:
5467
Id: MyFunction
5568
Permissions:
5669
- Write
70+
Properties:
71+
Name: MyApiV2
5772

5873
MySNSTopic:
5974
Type: AWS::SNS::Topic

tests/translator/input/function_with_alias_and_all_properties_property.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Resources:
4242
- x86_64
4343
EphemeralStorage:
4444
Size: 1024
45-
Role: !Sub arn:${AWS::Partition}:iam::role
45+
Role: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/role1
4646
KmsKeyArn: !Sub arn:${AWS::Partition}:key:key
4747
FileSystemConfigs:
4848
- Arn: !GetAtt AccessPoint.Arn
@@ -72,7 +72,7 @@ Resources:
7272
- x86_64
7373
EphemeralStorage:
7474
Size: 1024
75-
Role: !Sub arn:${AWS::Partition}:iam::role
75+
Role: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/role1
7676
KmsKeyArn: !Sub arn:${AWS::Partition}:key:key
7777
FileSystemConfigs:
7878
- Arn: !GetAtt AccessPoint.Arn

tests/translator/input/function_with_sns_event_source_all_parameters.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Resources:
99
NotificationTopic:
1010
Type: SNS
1111
Properties:
12-
Topic: topicArn-letsAddMoreSymbols
12+
Topic: arn:aws:sns:us-west-2:987654321098:key/dec86919-7219-4e8d-8871-7f1609df2c7f
1313
Region: region
1414
FilterPolicy:
1515
store:

tests/translator/input/graphqlapi_ddb_datasource_connector.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Resources:
1818
DynamoDb:
1919
MyDataSource:
2020
TableName: some-table
21-
TableArn: big-arn
21+
TableArn: arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f
2222
AnotherDataSource:
2323
TableName: cool-table
24-
TableArn: table-arn
24+
TableArn: arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f

tests/translator/input/graphqlapi_lambda_datasource_connector.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ Resources:
1717
DataSources:
1818
Lambda:
1919
MyDataSource:
20-
FunctionArn: blah
20+
FunctionArn: arn:aws:lambda:us-west-2:987654321098:function:dec86919-7219-4e8d-8871-7f1609df2c7f

tests/translator/output/all_policy_templates.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@
15801580
"Fn::Sub": [
15811581
"${certificateArn}",
15821582
{
1583-
"certificateArn": "arn"
1583+
"certificateArn": "arn:aws:acm:us-west-2:987654321098:certificate/dec86919-7219-4e8d-8871-7f1609df2c7f"
15841584
}
15851585
]
15861586
}

tests/translator/output/aws-cn/all_policy_templates.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@
15801580
"Fn::Sub": [
15811581
"${certificateArn}",
15821582
{
1583-
"certificateArn": "arn"
1583+
"certificateArn": "arn:aws:acm:us-west-2:987654321098:certificate/dec86919-7219-4e8d-8871-7f1609df2c7f"
15841584
}
15851585
]
15861586
}

tests/translator/output/aws-cn/connector_with_non_id_source_and_destination.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@
183183
]
184184
},
185185
"ManagedPolicyArns": [
186-
"arn:{AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
186+
{
187+
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
188+
}
187189
]
188190
},
189191
"Type": "AWS::IAM::Role"

tests/translator/output/aws-cn/embedded_connectors_hardcoded_props.json

+17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"Resources": {
33
"MyApiV1": {
4+
"Properties": {
5+
"Name": "MyApiV1"
6+
},
47
"Type": "AWS::ApiGateway::RestApi"
58
},
69
"MyApiV1ApiV1ToLambdaWriteLambdaPermission": {
@@ -40,6 +43,9 @@
4043
"Type": "AWS::Lambda::Permission"
4144
},
4245
"MyApiV2": {
46+
"Properties": {
47+
"Name": "MyApiV2"
48+
},
4349
"Type": "AWS::ApiGatewayV2::Api"
4450
},
4551
"MyApiV2ApiV2ToLambdaWriteLambdaPermission": {
@@ -79,6 +85,14 @@
7985
"Type": "AWS::Lambda::Permission"
8086
},
8187
"MyFunction": {
88+
"Properties": {
89+
"Code": {
90+
"ZipFile": "exports.handler = function(event, context, callback) {\n return callback(null, 'success');\n}\n"
91+
},
92+
"Handler": "index.handler",
93+
"Role": "arn:aws:iam::111122223333:role/lambda-role",
94+
"Runtime": "nodejs20.x"
95+
},
8296
"Type": "AWS::Lambda::Function"
8397
},
8498
"MyQueue": {
@@ -88,6 +102,9 @@
88102
"Type": "AWS::SQS::Queue"
89103
},
90104
"MyRule": {
105+
"Properties": {
106+
"ScheduleExpression": "rate(5 minutes)"
107+
},
91108
"Type": "AWS::Events::Rule"
92109
},
93110
"MyRuleRuleToTopicTopicPolicy": {

tests/translator/output/aws-cn/function_with_alias_and_all_properties_property.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"PackageType": "Zip",
4747
"ReservedConcurrentExecutions": 100,
4848
"Role": {
49-
"Fn::Sub": "arn:${AWS::Partition}:iam::role"
49+
"Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/role1"
5050
},
5151
"Runtime": "python2.7",
5252
"Tags": [
@@ -74,15 +74,15 @@
7474
},
7575
"FunctionVersion": {
7676
"Fn::GetAtt": [
77-
"HashChangeFunctionVersion17ca83d2bf",
77+
"HashChangeFunctionVersiona1a9d4d1e4",
7878
"Version"
7979
]
8080
},
8181
"Name": "live"
8282
},
8383
"Type": "AWS::Lambda::Alias"
8484
},
85-
"HashChangeFunctionVersion17ca83d2bf": {
85+
"HashChangeFunctionVersiona1a9d4d1e4": {
8686
"DeletionPolicy": "Retain",
8787
"Properties": {
8888
"Description": "sam-testing",
@@ -127,7 +127,7 @@
127127
"PackageType": "Zip",
128128
"ReservedConcurrentExecutions": 100,
129129
"Role": {
130-
"Fn::Sub": "arn:${AWS::Partition}:iam::role"
130+
"Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/role1"
131131
},
132132
"Runtime": "python2.7",
133133
"Tags": [

tests/translator/output/aws-cn/function_with_sns_event_source_all_parameters.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"FilterPolicyScope": "MessageAttributes",
6363
"Protocol": "lambda",
6464
"Region": "region",
65-
"TopicArn": "topicArn-letsAddMoreSymbols"
65+
"TopicArn": "arn:aws:sns:us-west-2:987654321098:key/dec86919-7219-4e8d-8871-7f1609df2c7f"
6666
},
6767
"Type": "AWS::SNS::Subscription"
6868
},
@@ -73,7 +73,7 @@
7373
"Ref": "MyAwesomeFunction"
7474
},
7575
"Principal": "sns.amazonaws.com",
76-
"SourceArn": "topicArn-letsAddMoreSymbols"
76+
"SourceArn": "arn:aws:sns:us-west-2:987654321098:key/dec86919-7219-4e8d-8871-7f1609df2c7f"
7777
},
7878
"Type": "AWS::Lambda::Permission"
7979
},

tests/translator/output/aws-cn/graphqlapi_ddb_datasource_connector.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@
104104
],
105105
"Effect": "Allow",
106106
"Resource": [
107-
"table-arn",
107+
"arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f",
108108
{
109109
"Fn::Sub": [
110110
"${DestinationArn}/index/*",
111111
{
112-
"DestinationArn": "table-arn"
112+
"DestinationArn": "arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f"
113113
}
114114
]
115115
}
@@ -127,12 +127,12 @@
127127
],
128128
"Effect": "Allow",
129129
"Resource": [
130-
"table-arn",
130+
"arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f",
131131
{
132132
"Fn::Sub": [
133133
"${DestinationArn}/index/*",
134134
{
135-
"DestinationArn": "table-arn"
135+
"DestinationArn": "arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f"
136136
}
137137
]
138138
}
@@ -248,12 +248,12 @@
248248
],
249249
"Effect": "Allow",
250250
"Resource": [
251-
"big-arn",
251+
"arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f",
252252
{
253253
"Fn::Sub": [
254254
"${DestinationArn}/index/*",
255255
{
256-
"DestinationArn": "big-arn"
256+
"DestinationArn": "arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f"
257257
}
258258
]
259259
}
@@ -271,12 +271,12 @@
271271
],
272272
"Effect": "Allow",
273273
"Resource": [
274-
"big-arn",
274+
"arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f",
275275
{
276276
"Fn::Sub": [
277277
"${DestinationArn}/index/*",
278278
{
279-
"DestinationArn": "big-arn"
279+
"DestinationArn": "arn:aws:dynamodb:us-west-2:987654321098:table/dec86919-7219-4e8d-8871-7f1609df2c7f"
280280
}
281281
]
282282
}

tests/translator/output/aws-cn/graphqlapi_lambda_datasource_connector.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
]
6767
},
6868
"LambdaConfig": {
69-
"LambdaFunctionArn": "blah"
69+
"LambdaFunctionArn": "arn:aws:lambda:us-west-2:987654321098:function:dec86919-7219-4e8d-8871-7f1609df2c7f"
7070
},
7171
"Name": "MyDataSource",
7272
"ServiceRoleArn": {
@@ -123,12 +123,12 @@
123123
],
124124
"Effect": "Allow",
125125
"Resource": [
126-
"blah",
126+
"arn:aws:lambda:us-west-2:987654321098:function:dec86919-7219-4e8d-8871-7f1609df2c7f",
127127
{
128128
"Fn::Sub": [
129129
"${DestinationArn}:*",
130130
{
131-
"DestinationArn": "blah"
131+
"DestinationArn": "arn:aws:lambda:us-west-2:987654321098:function:dec86919-7219-4e8d-8871-7f1609df2c7f"
132132
}
133133
]
134134
}

tests/translator/output/aws-us-gov/all_policy_templates.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@
15801580
"Fn::Sub": [
15811581
"${certificateArn}",
15821582
{
1583-
"certificateArn": "arn"
1583+
"certificateArn": "arn:aws:acm:us-west-2:987654321098:certificate/dec86919-7219-4e8d-8871-7f1609df2c7f"
15841584
}
15851585
]
15861586
}

tests/translator/output/aws-us-gov/connector_with_non_id_source_and_destination.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@
183183
]
184184
},
185185
"ManagedPolicyArns": [
186-
"arn:{AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
186+
{
187+
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
188+
}
187189
]
188190
},
189191
"Type": "AWS::IAM::Role"

0 commit comments

Comments
 (0)