Skip to content

Commit 149fb67

Browse files
authored
Ipv6Address count for NetworkInterface (#3656)
1 parent ad55796 commit 149fb67

File tree

7 files changed

+123
-0
lines changed

7 files changed

+123
-0
lines changed

scripts/update_schemas_manually.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,20 @@
727727
),
728728
],
729729
),
730+
ResourcePatch(
731+
resource_type="AWS::EC2::NetworkInterface",
732+
patches=[
733+
Patch(
734+
values={
735+
"dependentExcluded": {
736+
"Ipv6AddressCount": ["Ipv6Addresses"],
737+
"Ipv6Addresses": ["Ipv6AddressCount"],
738+
},
739+
},
740+
path="/",
741+
),
742+
],
743+
),
730744
ResourcePatch(
731745
resource_type="AWS::EC2::SecurityGroup",
732746
patches=[

scripts/update_snapshot_results.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ cfn-lint test/fixtures/templates/integration/dynamic-references.yaml -e -c I --f
55
cfn-lint test/fixtures/templates/integration/resources-cloudformation-init.yaml -e -c I --format json > test/fixtures/results/integration/resources-cloudformation-init.json
66
cfn-lint test/fixtures/templates/integration/ref-no-value.yaml -e -c I --format json > test/fixtures/results/integration/ref-no-value.json
77
cfn-lint test/fixtures/templates/integration/availability-zones.yaml -e -c I --format json > test/fixtures/results/integration/availability-zones.json
8+
cfn-lint test/fixtures/templates/integration/aws-ec2-networkinterface.yaml -e -c I --format json > test/fixtures/results/integration/aws-ec2-networkinterface.json
89

910
# public/
1011
cfn-lint test/fixtures/templates/public/lambda-poller.yaml -e -c I --format json > test/fixtures/results/public/lambda-poller.json
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"op": "add",
4+
"path": "/dependentExcluded",
5+
"value": {
6+
"Ipv6AddressCount": [
7+
"Ipv6Addresses"
8+
],
9+
"Ipv6Addresses": [
10+
"Ipv6AddressCount"
11+
]
12+
}
13+
}
14+
]

src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-networkinterface.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@
9696
"type": "object"
9797
}
9898
},
99+
"dependentExcluded": {
100+
"Ipv6AddressCount": [
101+
"Ipv6Addresses"
102+
],
103+
"Ipv6Addresses": [
104+
"Ipv6AddressCount"
105+
]
106+
},
99107
"primaryIdentifier": [
100108
"/properties/Id"
101109
],
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[
2+
{
3+
"Filename": "test/fixtures/templates/integration/aws-ec2-networkinterface.yaml",
4+
"Id": "9d40fd01-0117-1816-b924-0b0c89ee7a5e",
5+
"Level": "Error",
6+
"Location": {
7+
"End": {
8+
"ColumnNumber": 20,
9+
"LineNumber": 15
10+
},
11+
"Path": [
12+
"Resources",
13+
"NetworkInterface",
14+
"Properties",
15+
"Ipv6Addresses"
16+
],
17+
"Start": {
18+
"ColumnNumber": 7,
19+
"LineNumber": 15
20+
}
21+
},
22+
"Message": "'Ipv6Addresses' should not be included with 'Ipv6AddressCount'",
23+
"ParentId": null,
24+
"Rule": {
25+
"Description": "When certain properties are specified other properties should not be included",
26+
"Id": "E3020",
27+
"ShortDescription": "Validate that when a property is specified another property should be excluded",
28+
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
29+
}
30+
},
31+
{
32+
"Filename": "test/fixtures/templates/integration/aws-ec2-networkinterface.yaml",
33+
"Id": "e26370d1-ed25-a14c-9a48-7cabc88945ec",
34+
"Level": "Error",
35+
"Location": {
36+
"End": {
37+
"ColumnNumber": 23,
38+
"LineNumber": 17
39+
},
40+
"Path": [
41+
"Resources",
42+
"NetworkInterface",
43+
"Properties",
44+
"Ipv6AddressCount"
45+
],
46+
"Start": {
47+
"ColumnNumber": 7,
48+
"LineNumber": 17
49+
}
50+
},
51+
"Message": "'Ipv6AddressCount' should not be included with 'Ipv6Addresses'",
52+
"ParentId": null,
53+
"Rule": {
54+
"Description": "When certain properties are specified other properties should not be included",
55+
"Id": "E3020",
56+
"ShortDescription": "Validate that when a property is specified another property should be excluded",
57+
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
58+
}
59+
}
60+
]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Parameters:
2+
SubnetId:
3+
Type: AWS::EC2::Subnet::Id
4+
SecurityGroupId:
5+
Type: AWS::EC2::SecurityGroup::Id
6+
Resources:
7+
NetworkInterface:
8+
Type: AWS::EC2::NetworkInterface
9+
Properties:
10+
Description: "a network interface"
11+
GroupSet:
12+
- !Ref SecurityGroupId
13+
SourceDestCheck: false
14+
SubnetId: !Ref SubnetId
15+
Ipv6Addresses:
16+
- Ipv6Address: abc
17+
Ipv6AddressCount: 1

test/integration/test_integration_templates.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ class TestQuickStartTemplates(BaseCliTestCase):
4747
),
4848
"exit_code": 2,
4949
},
50+
{
51+
"filename": (
52+
"test/fixtures/templates/integration/aws-ec2-networkinterface.yaml"
53+
),
54+
"results_filename": (
55+
"test/fixtures/results/integration/aws-ec2-networkinterface.json"
56+
),
57+
"exit_code": 2,
58+
},
5059
]
5160

5261
def test_templates(self):

0 commit comments

Comments
 (0)