Skip to content

Commit

Permalink
Ipv6Address count for NetworkInterface (#3656)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong authored Sep 6, 2024
1 parent ad55796 commit 149fb67
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/update_schemas_manually.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,20 @@
),
],
),
ResourcePatch(
resource_type="AWS::EC2::NetworkInterface",
patches=[
Patch(
values={
"dependentExcluded": {
"Ipv6AddressCount": ["Ipv6Addresses"],
"Ipv6Addresses": ["Ipv6AddressCount"],
},
},
path="/",
),
],
),
ResourcePatch(
resource_type="AWS::EC2::SecurityGroup",
patches=[
Expand Down
1 change: 1 addition & 0 deletions scripts/update_snapshot_results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cfn-lint test/fixtures/templates/integration/dynamic-references.yaml -e -c I --f
cfn-lint test/fixtures/templates/integration/resources-cloudformation-init.yaml -e -c I --format json > test/fixtures/results/integration/resources-cloudformation-init.json
cfn-lint test/fixtures/templates/integration/ref-no-value.yaml -e -c I --format json > test/fixtures/results/integration/ref-no-value.json
cfn-lint test/fixtures/templates/integration/availability-zones.yaml -e -c I --format json > test/fixtures/results/integration/availability-zones.json
cfn-lint test/fixtures/templates/integration/aws-ec2-networkinterface.yaml -e -c I --format json > test/fixtures/results/integration/aws-ec2-networkinterface.json

# public/
cfn-lint test/fixtures/templates/public/lambda-poller.yaml -e -c I --format json > test/fixtures/results/public/lambda-poller.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"op": "add",
"path": "/dependentExcluded",
"value": {
"Ipv6AddressCount": [
"Ipv6Addresses"
],
"Ipv6Addresses": [
"Ipv6AddressCount"
]
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@
"type": "object"
}
},
"dependentExcluded": {
"Ipv6AddressCount": [
"Ipv6Addresses"
],
"Ipv6Addresses": [
"Ipv6AddressCount"
]
},
"primaryIdentifier": [
"/properties/Id"
],
Expand Down
60 changes: 60 additions & 0 deletions test/fixtures/results/integration/aws-ec2-networkinterface.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[
{
"Filename": "test/fixtures/templates/integration/aws-ec2-networkinterface.yaml",
"Id": "9d40fd01-0117-1816-b924-0b0c89ee7a5e",
"Level": "Error",
"Location": {
"End": {
"ColumnNumber": 20,
"LineNumber": 15
},
"Path": [
"Resources",
"NetworkInterface",
"Properties",
"Ipv6Addresses"
],
"Start": {
"ColumnNumber": 7,
"LineNumber": 15
}
},
"Message": "'Ipv6Addresses' should not be included with 'Ipv6AddressCount'",
"ParentId": null,
"Rule": {
"Description": "When certain properties are specified other properties should not be included",
"Id": "E3020",
"ShortDescription": "Validate that when a property is specified another property should be excluded",
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
}
},
{
"Filename": "test/fixtures/templates/integration/aws-ec2-networkinterface.yaml",
"Id": "e26370d1-ed25-a14c-9a48-7cabc88945ec",
"Level": "Error",
"Location": {
"End": {
"ColumnNumber": 23,
"LineNumber": 17
},
"Path": [
"Resources",
"NetworkInterface",
"Properties",
"Ipv6AddressCount"
],
"Start": {
"ColumnNumber": 7,
"LineNumber": 17
}
},
"Message": "'Ipv6AddressCount' should not be included with 'Ipv6Addresses'",
"ParentId": null,
"Rule": {
"Description": "When certain properties are specified other properties should not be included",
"Id": "E3020",
"ShortDescription": "Validate that when a property is specified another property should be excluded",
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
}
}
]
17 changes: 17 additions & 0 deletions test/fixtures/templates/integration/aws-ec2-networkinterface.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Parameters:
SubnetId:
Type: AWS::EC2::Subnet::Id
SecurityGroupId:
Type: AWS::EC2::SecurityGroup::Id
Resources:
NetworkInterface:
Type: AWS::EC2::NetworkInterface
Properties:
Description: "a network interface"
GroupSet:
- !Ref SecurityGroupId
SourceDestCheck: false
SubnetId: !Ref SubnetId
Ipv6Addresses:
- Ipv6Address: abc
Ipv6AddressCount: 1
9 changes: 9 additions & 0 deletions test/integration/test_integration_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ class TestQuickStartTemplates(BaseCliTestCase):
),
"exit_code": 2,
},
{
"filename": (
"test/fixtures/templates/integration/aws-ec2-networkinterface.yaml"
),
"results_filename": (
"test/fixtures/results/integration/aws-ec2-networkinterface.json"
),
"exit_code": 2,
},
]

def test_templates(self):
Expand Down

0 comments on commit 149fb67

Please sign in to comment.