Skip to content

Commit cc1b2f7

Browse files
authored
AssociateCarrierIpAddress and AssociatePublicIpAddress not with NetworkInterfaceId (#3685)
1 parent 3100f8c commit cc1b2f7

File tree

12 files changed

+435
-0
lines changed

12 files changed

+435
-0
lines changed

scripts/update_schemas_manually.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,19 @@
701701
},
702702
path="/",
703703
),
704+
Patch(
705+
values={
706+
"dependentExcluded": {
707+
"AssociateCarrierIpAddress": ["NetworkInterfaceId"],
708+
"AssociatePublicIpAddress": ["NetworkInterfaceId"],
709+
"NetworkInterfaceId": [
710+
"AssociateCarrierIpAddress",
711+
"AssociatePublicIpAddress",
712+
],
713+
}
714+
},
715+
path="/definitions/NetworkInterface",
716+
),
704717
],
705718
),
706719
ResourcePatch(
@@ -714,6 +727,19 @@
714727
values={"pattern": "^ephemeral([0-9]|[1][0-9]|[2][0-3])$"},
715728
path="/definitions/BlockDeviceMapping/properties/VirtualName",
716729
),
730+
Patch(
731+
values={
732+
"dependentExcluded": {
733+
"AssociateCarrierIpAddress": ["NetworkInterfaceId"],
734+
"AssociatePublicIpAddress": ["NetworkInterfaceId"],
735+
"NetworkInterfaceId": [
736+
"AssociateCarrierIpAddress",
737+
"AssociatePublicIpAddress",
738+
],
739+
}
740+
},
741+
path="/definitions/NetworkInterface",
742+
),
717743
],
718744
),
719745
ResourcePatch(

scripts/update_snapshot_results.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ cfn-lint test/fixtures/templates/integration/resources-cloudformation-init.yaml
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
88
cfn-lint test/fixtures/templates/integration/aws-ec2-networkinterface.yaml -e -c I --format json > test/fixtures/results/integration/aws-ec2-networkinterface.json
9+
cfn-lint test/fixtures/templates/integration/aws-ec2-instance.yaml -e -c I --format json > test/fixtures/results/integration/aws-ec2-instance.json
10+
cfn-lint test/fixtures/templates/integration/aws-ec2-launchtemplate.yaml -e -c I --format json > test/fixtures/results/integration/aws-ec2-launchtemplate.json
911

1012
# public/
1113
cfn-lint test/fixtures/templates/public/lambda-poller.yaml -e -c I --format json > test/fixtures/results/public/lambda-poller.json

src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_instance/manual.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,21 @@
2424
"NetworkInterfaces"
2525
]
2626
}
27+
},
28+
{
29+
"op": "add",
30+
"path": "/definitions/NetworkInterface/dependentExcluded",
31+
"value": {
32+
"AssociateCarrierIpAddress": [
33+
"NetworkInterfaceId"
34+
],
35+
"AssociatePublicIpAddress": [
36+
"NetworkInterfaceId"
37+
],
38+
"NetworkInterfaceId": [
39+
"AssociateCarrierIpAddress",
40+
"AssociatePublicIpAddress"
41+
]
42+
}
2743
}
2844
]

src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_launchtemplate/manual.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,21 @@
1212
"op": "add",
1313
"path": "/definitions/BlockDeviceMapping/properties/VirtualName/pattern",
1414
"value": "^ephemeral([0-9]|[1][0-9]|[2][0-3])$"
15+
},
16+
{
17+
"op": "add",
18+
"path": "/definitions/NetworkInterface/dependentExcluded",
19+
"value": {
20+
"AssociateCarrierIpAddress": [
21+
"NetworkInterfaceId"
22+
],
23+
"AssociatePublicIpAddress": [
24+
"NetworkInterfaceId"
25+
],
26+
"NetworkInterfaceId": [
27+
"AssociateCarrierIpAddress",
28+
"AssociatePublicIpAddress"
29+
]
30+
}
1531
}
1632
]

src/cfnlint/data/schemas/providers/ap_southeast_5/aws-ec2-instance.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,18 @@
205205
},
206206
"NetworkInterface": {
207207
"additionalProperties": false,
208+
"dependentExcluded": {
209+
"AssociateCarrierIpAddress": [
210+
"NetworkInterfaceId"
211+
],
212+
"AssociatePublicIpAddress": [
213+
"NetworkInterfaceId"
214+
],
215+
"NetworkInterfaceId": [
216+
"AssociateCarrierIpAddress",
217+
"AssociatePublicIpAddress"
218+
]
219+
},
208220
"properties": {
209221
"AssociateCarrierIpAddress": {
210222
"type": "boolean"

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,18 @@
195195
},
196196
"NetworkInterface": {
197197
"additionalProperties": false,
198+
"dependentExcluded": {
199+
"AssociateCarrierIpAddress": [
200+
"NetworkInterfaceId"
201+
],
202+
"AssociatePublicIpAddress": [
203+
"NetworkInterfaceId"
204+
],
205+
"NetworkInterfaceId": [
206+
"AssociateCarrierIpAddress",
207+
"AssociatePublicIpAddress"
208+
]
209+
},
198210
"properties": {
199211
"AssociateCarrierIpAddress": {
200212
"type": "boolean"

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,18 @@
637637
},
638638
"NetworkInterface": {
639639
"additionalProperties": false,
640+
"dependentExcluded": {
641+
"AssociateCarrierIpAddress": [
642+
"NetworkInterfaceId"
643+
],
644+
"AssociatePublicIpAddress": [
645+
"NetworkInterfaceId"
646+
],
647+
"NetworkInterfaceId": [
648+
"AssociateCarrierIpAddress",
649+
"AssociatePublicIpAddress"
650+
]
651+
},
640652
"properties": {
641653
"AssociateCarrierIpAddress": {
642654
"type": "boolean"
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
[
2+
{
3+
"Filename": "test/fixtures/templates/integration/aws-ec2-instance.yaml",
4+
"Id": "1a19d9d5-cf14-50d0-d2f5-9ebd5b73a7d4",
5+
"Level": "Error",
6+
"Location": {
7+
"End": {
8+
"ColumnNumber": 36,
9+
"LineNumber": 14
10+
},
11+
"Path": [
12+
"Resources",
13+
"Instance",
14+
"Properties",
15+
"NetworkInterfaces",
16+
0,
17+
"AssociateCarrierIpAddress"
18+
],
19+
"Start": {
20+
"ColumnNumber": 11,
21+
"LineNumber": 14
22+
}
23+
},
24+
"Message": "'AssociateCarrierIpAddress' should not be included with 'NetworkInterfaceId'",
25+
"ParentId": null,
26+
"Rule": {
27+
"Description": "When certain properties are specified other properties should not be included",
28+
"Id": "E3020",
29+
"ShortDescription": "Validate that when a property is specified another property should be excluded",
30+
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
31+
}
32+
},
33+
{
34+
"Filename": "test/fixtures/templates/integration/aws-ec2-instance.yaml",
35+
"Id": "62b86da6-4603-37c5-3087-299f72acc9a2",
36+
"Level": "Error",
37+
"Location": {
38+
"End": {
39+
"ColumnNumber": 35,
40+
"LineNumber": 15
41+
},
42+
"Path": [
43+
"Resources",
44+
"Instance",
45+
"Properties",
46+
"NetworkInterfaces",
47+
0,
48+
"AssociatePublicIpAddress"
49+
],
50+
"Start": {
51+
"ColumnNumber": 11,
52+
"LineNumber": 15
53+
}
54+
},
55+
"Message": "'AssociatePublicIpAddress' should not be included with 'NetworkInterfaceId'",
56+
"ParentId": null,
57+
"Rule": {
58+
"Description": "When certain properties are specified other properties should not be included",
59+
"Id": "E3020",
60+
"ShortDescription": "Validate that when a property is specified another property should be excluded",
61+
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
62+
}
63+
},
64+
{
65+
"Filename": "test/fixtures/templates/integration/aws-ec2-instance.yaml",
66+
"Id": "6cf986c0-5afe-2cdd-5da0-2a411f486e56",
67+
"Level": "Error",
68+
"Location": {
69+
"End": {
70+
"ColumnNumber": 29,
71+
"LineNumber": 17
72+
},
73+
"Path": [
74+
"Resources",
75+
"Instance",
76+
"Properties",
77+
"NetworkInterfaces",
78+
0,
79+
"NetworkInterfaceId"
80+
],
81+
"Start": {
82+
"ColumnNumber": 11,
83+
"LineNumber": 17
84+
}
85+
},
86+
"Message": "'NetworkInterfaceId' should not be included with 'AssociateCarrierIpAddress'",
87+
"ParentId": null,
88+
"Rule": {
89+
"Description": "When certain properties are specified other properties should not be included",
90+
"Id": "E3020",
91+
"ShortDescription": "Validate that when a property is specified another property should be excluded",
92+
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
93+
}
94+
},
95+
{
96+
"Filename": "test/fixtures/templates/integration/aws-ec2-instance.yaml",
97+
"Id": "697ee9aa-160c-152b-5d46-e708ed04b425",
98+
"Level": "Error",
99+
"Location": {
100+
"End": {
101+
"ColumnNumber": 29,
102+
"LineNumber": 17
103+
},
104+
"Path": [
105+
"Resources",
106+
"Instance",
107+
"Properties",
108+
"NetworkInterfaces",
109+
0,
110+
"NetworkInterfaceId"
111+
],
112+
"Start": {
113+
"ColumnNumber": 11,
114+
"LineNumber": 17
115+
}
116+
},
117+
"Message": "'NetworkInterfaceId' should not be included with 'AssociatePublicIpAddress'",
118+
"ParentId": null,
119+
"Rule": {
120+
"Description": "When certain properties are specified other properties should not be included",
121+
"Id": "E3020",
122+
"ShortDescription": "Validate that when a property is specified another property should be excluded",
123+
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
124+
}
125+
}
126+
]

0 commit comments

Comments
 (0)