Skip to content

Commit

Permalink
AssociateCarrierIpAddress and AssociatePublicIpAddress not with Netwo…
Browse files Browse the repository at this point in the history
…rkInterfaceId (#3685)
  • Loading branch information
kddejong authored Sep 12, 2024
1 parent 3100f8c commit cc1b2f7
Show file tree
Hide file tree
Showing 12 changed files with 435 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/update_schemas_manually.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,19 @@
},
path="/",
),
Patch(
values={
"dependentExcluded": {
"AssociateCarrierIpAddress": ["NetworkInterfaceId"],
"AssociatePublicIpAddress": ["NetworkInterfaceId"],
"NetworkInterfaceId": [
"AssociateCarrierIpAddress",
"AssociatePublicIpAddress",
],
}
},
path="/definitions/NetworkInterface",
),
],
),
ResourcePatch(
Expand All @@ -714,6 +727,19 @@
values={"pattern": "^ephemeral([0-9]|[1][0-9]|[2][0-3])$"},
path="/definitions/BlockDeviceMapping/properties/VirtualName",
),
Patch(
values={
"dependentExcluded": {
"AssociateCarrierIpAddress": ["NetworkInterfaceId"],
"AssociatePublicIpAddress": ["NetworkInterfaceId"],
"NetworkInterfaceId": [
"AssociateCarrierIpAddress",
"AssociatePublicIpAddress",
],
}
},
path="/definitions/NetworkInterface",
),
],
),
ResourcePatch(
Expand Down
2 changes: 2 additions & 0 deletions scripts/update_snapshot_results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ cfn-lint test/fixtures/templates/integration/resources-cloudformation-init.yaml
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
cfn-lint test/fixtures/templates/integration/aws-ec2-instance.yaml -e -c I --format json > test/fixtures/results/integration/aws-ec2-instance.json
cfn-lint test/fixtures/templates/integration/aws-ec2-launchtemplate.yaml -e -c I --format json > test/fixtures/results/integration/aws-ec2-launchtemplate.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
Expand Up @@ -24,5 +24,21 @@
"NetworkInterfaces"
]
}
},
{
"op": "add",
"path": "/definitions/NetworkInterface/dependentExcluded",
"value": {
"AssociateCarrierIpAddress": [
"NetworkInterfaceId"
],
"AssociatePublicIpAddress": [
"NetworkInterfaceId"
],
"NetworkInterfaceId": [
"AssociateCarrierIpAddress",
"AssociatePublicIpAddress"
]
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,21 @@
"op": "add",
"path": "/definitions/BlockDeviceMapping/properties/VirtualName/pattern",
"value": "^ephemeral([0-9]|[1][0-9]|[2][0-3])$"
},
{
"op": "add",
"path": "/definitions/NetworkInterface/dependentExcluded",
"value": {
"AssociateCarrierIpAddress": [
"NetworkInterfaceId"
],
"AssociatePublicIpAddress": [
"NetworkInterfaceId"
],
"NetworkInterfaceId": [
"AssociateCarrierIpAddress",
"AssociatePublicIpAddress"
]
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@
},
"NetworkInterface": {
"additionalProperties": false,
"dependentExcluded": {
"AssociateCarrierIpAddress": [
"NetworkInterfaceId"
],
"AssociatePublicIpAddress": [
"NetworkInterfaceId"
],
"NetworkInterfaceId": [
"AssociateCarrierIpAddress",
"AssociatePublicIpAddress"
]
},
"properties": {
"AssociateCarrierIpAddress": {
"type": "boolean"
Expand Down
12 changes: 12 additions & 0 deletions src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-instance.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@
},
"NetworkInterface": {
"additionalProperties": false,
"dependentExcluded": {
"AssociateCarrierIpAddress": [
"NetworkInterfaceId"
],
"AssociatePublicIpAddress": [
"NetworkInterfaceId"
],
"NetworkInterfaceId": [
"AssociateCarrierIpAddress",
"AssociatePublicIpAddress"
]
},
"properties": {
"AssociateCarrierIpAddress": {
"type": "boolean"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,18 @@
},
"NetworkInterface": {
"additionalProperties": false,
"dependentExcluded": {
"AssociateCarrierIpAddress": [
"NetworkInterfaceId"
],
"AssociatePublicIpAddress": [
"NetworkInterfaceId"
],
"NetworkInterfaceId": [
"AssociateCarrierIpAddress",
"AssociatePublicIpAddress"
]
},
"properties": {
"AssociateCarrierIpAddress": {
"type": "boolean"
Expand Down
126 changes: 126 additions & 0 deletions test/fixtures/results/integration/aws-ec2-instance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
[
{
"Filename": "test/fixtures/templates/integration/aws-ec2-instance.yaml",
"Id": "1a19d9d5-cf14-50d0-d2f5-9ebd5b73a7d4",
"Level": "Error",
"Location": {
"End": {
"ColumnNumber": 36,
"LineNumber": 14
},
"Path": [
"Resources",
"Instance",
"Properties",
"NetworkInterfaces",
0,
"AssociateCarrierIpAddress"
],
"Start": {
"ColumnNumber": 11,
"LineNumber": 14
}
},
"Message": "'AssociateCarrierIpAddress' should not be included with 'NetworkInterfaceId'",
"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-instance.yaml",
"Id": "62b86da6-4603-37c5-3087-299f72acc9a2",
"Level": "Error",
"Location": {
"End": {
"ColumnNumber": 35,
"LineNumber": 15
},
"Path": [
"Resources",
"Instance",
"Properties",
"NetworkInterfaces",
0,
"AssociatePublicIpAddress"
],
"Start": {
"ColumnNumber": 11,
"LineNumber": 15
}
},
"Message": "'AssociatePublicIpAddress' should not be included with 'NetworkInterfaceId'",
"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-instance.yaml",
"Id": "6cf986c0-5afe-2cdd-5da0-2a411f486e56",
"Level": "Error",
"Location": {
"End": {
"ColumnNumber": 29,
"LineNumber": 17
},
"Path": [
"Resources",
"Instance",
"Properties",
"NetworkInterfaces",
0,
"NetworkInterfaceId"
],
"Start": {
"ColumnNumber": 11,
"LineNumber": 17
}
},
"Message": "'NetworkInterfaceId' should not be included with 'AssociateCarrierIpAddress'",
"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-instance.yaml",
"Id": "697ee9aa-160c-152b-5d46-e708ed04b425",
"Level": "Error",
"Location": {
"End": {
"ColumnNumber": 29,
"LineNumber": 17
},
"Path": [
"Resources",
"Instance",
"Properties",
"NetworkInterfaces",
0,
"NetworkInterfaceId"
],
"Start": {
"ColumnNumber": 11,
"LineNumber": 17
}
},
"Message": "'NetworkInterfaceId' should not be included with 'AssociatePublicIpAddress'",
"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"
}
}
]
Loading

0 comments on commit cc1b2f7

Please sign in to comment.