Repository: aws-cloudformation/cfn-lint

Issue:
Both CidrBlock and Ipv4NetmaskLength cannot be specified
### Is this feature request related to a new rule or cfn-lint capabilities?

_No response_

### Describe the feature you'd like to request

When doing 

```
  Subnet:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref Vpc
      CidrBlock: 10.0.0.0/24
      Ipv4NetmaskLength: 10
```

### Describe the solution you'd like

Detect the error `Both CidrBlock and Ipv4NetmaskLength cannot be specified`

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [ ] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change


Discussion:
`Invalid request provided: Property CidrBlock or Ipv4IpamPoolId cannot be empty.`



Patch:
diff --git a/scripts/update_schemas_manually.py b/scripts/update_schemas_manually.py
index f0da02b178..74beb6fdf3 100755
--- a/scripts/update_schemas_manually.py
+++ b/scripts/update_schemas_manually.py
@@ -898,7 +898,10 @@
                     path="/",
                     values={
                         "requiredXor": ["CidrBlock", "Ipv4IpamPoolId"],
-                        "dependentRequired": {"Ipv4IpamPoolId": ["Ipv4NetmaskLength"]},
+                        "dependentRequired": {
+                            "Ipv4IpamPoolId": ["Ipv4NetmaskLength"],
+                            "Ipv4NetmaskLength": ["Ipv4IpamPoolId"],
+                        },
                     },
                 ),
             ],
@@ -1631,10 +1634,15 @@
             patches=[
                 Patch(
                     values={
+                        "requiredXor": ["CidrBlock", "Ipv4IpamPoolId"],
                         "dependentExcluded": {
                             "AvailabilityZone": ["AvailabilityZoneId"],
                             "AvailabilityZoneId": ["AvailabilityZone"],
                         },
+                        "dependentRequired": {
+                            "Ipv4IpamPoolId": ["Ipv4NetmaskLength"],
+                            "Ipv4NetmaskLength": ["Ipv4IpamPoolId"],
+                        },
                     },
                     path="/",
                 ),
diff --git a/scripts/update_snapshot_results.sh b/scripts/update_snapshot_results.sh
index efb1b5d660..98c0f00a69 100755
--- a/scripts/update_snapshot_results.sh
+++ b/scripts/update_snapshot_results.sh
@@ -9,6 +9,7 @@ cfn-lint test/fixtures/templates/integration/getatt-types.yaml -e -c I --format
 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
+cfn-lint test/fixtures/templates/integration/aws-ec2-subnet.yaml -e -c I --format json > test/fixtures/results/integration/aws-ec2-subnet.json
 cfn-lint test/fixtures/templates/integration/aws-dynamodb-table.yaml -e -c I --format json > test/fixtures/results/integration/aws-dynamodb-table.json
 
 # public/
diff --git a/src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_subnet/manual.json b/src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_subnet/manual.json
index 853dd65adc..64637692be 100644
--- a/src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_subnet/manual.json
+++ b/src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_subnet/manual.json
@@ -1,4 +1,12 @@
 [
+ {
+  "op": "add",
+  "path": "/requiredXor",
+  "value": [
+   "CidrBlock",
+   "Ipv4IpamPoolId"
+  ]
+ },
  {
   "op": "add",
   "path": "/dependentExcluded",
@@ -10,5 +18,17 @@
     "AvailabilityZone"
    ]
   }
+ },
+ {
+  "op": "add",
+  "path": "/dependentRequired",
+  "value": {
+   "Ipv4IpamPoolId": [
+    "Ipv4NetmaskLength"
+   ],
+   "Ipv4NetmaskLength": [
+    "Ipv4IpamPoolId"
+   ]
+  }
  }
 ]
diff --git a/src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_vpc/manual.json b/src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_vpc/manual.json
index 1fa98973e3..5b68eb2382 100644
--- a/src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_vpc/manual.json
+++ b/src/cfnlint/data/schemas/patches/extensions/all/aws_ec2_vpc/manual.json
@@ -13,6 +13,9 @@
   "value": {
    "Ipv4IpamPoolId": [
     "Ipv4NetmaskLength"
+   ],
+   "Ipv4NetmaskLength": [
+    "Ipv4IpamPoolId"
    ]
   }
  }
diff --git a/src/cfnlint/data/schemas/providers/ap_southeast_5/aws-ec2-subnet.json b/src/cfnlint/data/schemas/providers/ap_southeast_5/aws-ec2-subnet.json
index 0397b7f9a0..ef3918fb82 100644
--- a/src/cfnlint/data/schemas/providers/ap_southeast_5/aws-ec2-subnet.json
+++ b/src/cfnlint/data/schemas/providers/ap_southeast_5/aws-ec2-subnet.json
@@ -41,6 +41,14 @@
    "AvailabilityZone"
   ]
  },
+ "dependentRequired": {
+  "Ipv4IpamPoolId": [
+   "Ipv4NetmaskLength"
+  ],
+  "Ipv4NetmaskLength": [
+   "Ipv4IpamPoolId"
+  ]
+ },
  "primaryIdentifier": [
   "/properties/SubnetId"
  ],
@@ -134,6 +142,10 @@
  "required": [
   "VpcId"
  ],
+ "requiredXor": [
+  "CidrBlock",
+  "Ipv4IpamPoolId"
+ ],
  "tagging": {
   "cloudFormationSystemTags": true,
   "tagOnCreate": true,
diff --git a/src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-subnet.json b/src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-subnet.json
index 6d19fe5448..ef2dc5e490 100644
--- a/src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-subnet.json
+++ b/src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-subnet.json
@@ -41,6 +41,14 @@
    "AvailabilityZone"
   ]
  },
+ "dependentRequired": {
+  "Ipv4IpamPoolId": [
+   "Ipv4NetmaskLength"
+  ],
+  "Ipv4NetmaskLength": [
+   "Ipv4IpamPoolId"
+  ]
+ },
  "primaryIdentifier": [
   "/properties/SubnetId"
  ],
@@ -135,6 +143,10 @@
  "required": [
   "VpcId"
  ],
+ "requiredXor": [
+  "CidrBlock",
+  "Ipv4IpamPoolId"
+ ],
  "tagging": {
   "cloudFormationSystemTags": true,
   "tagOnCreate": true,
diff --git a/src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-vpc.json b/src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-vpc.json
index 7efc1be7e8..7d76369077 100644
--- a/src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-vpc.json
+++ b/src/cfnlint/data/schemas/providers/us_east_1/aws-ec2-vpc.json
@@ -29,6 +29,9 @@
  "dependentRequired": {
   "Ipv4IpamPoolId": [
    "Ipv4NetmaskLength"
+  ],
+  "Ipv4NetmaskLength": [
+   "Ipv4IpamPoolId"
   ]
  },
  "primaryIdentifier": [


Test patch:
diff --git a/test/fixtures/results/integration/aws-ec2-subnet.json b/test/fixtures/results/integration/aws-ec2-subnet.json
new file mode 100644
index 0000000000..616b6f34a2
--- /dev/null
+++ b/test/fixtures/results/integration/aws-ec2-subnet.json
@@ -0,0 +1,86 @@
+[
+    {
+        "Filename": "test/fixtures/templates/integration/aws-ec2-subnet.yaml",
+        "Id": "5c96f1f9-9dfc-31e7-f24b-9e08af46c98f",
+        "Level": "Error",
+        "Location": {
+            "End": {
+                "ColumnNumber": 15,
+                "LineNumber": 7
+            },
+            "Path": [
+                "Resources",
+                "Subnet1",
+                "Properties"
+            ],
+            "Start": {
+                "ColumnNumber": 5,
+                "LineNumber": 7
+            }
+        },
+        "Message": "'Ipv4IpamPoolId' is a dependency of 'Ipv4NetmaskLength'",
+        "ParentId": null,
+        "Rule": {
+            "Description": "When certain properties are specified it results in other properties to be required",
+            "Id": "E3021",
+            "ShortDescription": "Validate that when a property is specified that other properties should be included",
+            "Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentrequired"
+        }
+    },
+    {
+        "Filename": "test/fixtures/templates/integration/aws-ec2-subnet.yaml",
+        "Id": "5c12a390-4b88-f609-d6d6-bd7fa2250f99",
+        "Level": "Error",
+        "Location": {
+            "End": {
+                "ColumnNumber": 15,
+                "LineNumber": 13
+            },
+            "Path": [
+                "Resources",
+                "Subnet2",
+                "Properties"
+            ],
+            "Start": {
+                "ColumnNumber": 5,
+                "LineNumber": 13
+            }
+        },
+        "Message": "Only one of ['CidrBlock', 'Ipv4IpamPoolId'] is a required property",
+        "ParentId": null,
+        "Rule": {
+            "Description": "Make sure that Resources properties that are required exist. Along with other properties not being specified",
+            "Id": "E3014",
+            "ShortDescription": "Validate only one of a set of required properties are specified",
+            "Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#requiredxor"
+        }
+    },
+    {
+        "Filename": "test/fixtures/templates/integration/aws-ec2-subnet.yaml",
+        "Id": "7a696880-e120-60b6-93b9-a57a48d71189",
+        "Level": "Error",
+        "Location": {
+            "End": {
+                "ColumnNumber": 15,
+                "LineNumber": 17
+            },
+            "Path": [
+                "Resources",
+                "Subnet3",
+                "Properties"
+            ],
+            "Start": {
+                "ColumnNumber": 5,
+                "LineNumber": 17
+            }
+        },
+        "Message": "'Ipv4NetmaskLength' is a dependency of 'Ipv4IpamPoolId'",
+        "ParentId": null,
+        "Rule": {
+            "Description": "When certain properties are specified it results in other properties to be required",
+            "Id": "E3021",
+            "ShortDescription": "Validate that when a property is specified that other properties should be included",
+            "Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentrequired"
+        }
+    }
+]
diff --git a/test/fixtures/templates/integration/aws-ec2-subnet.yaml b/test/fixtures/templates/integration/aws-ec2-subnet.yaml
new file mode 100644
index 0000000000..612fd56e64
--- /dev/null
+++ b/test/fixtures/templates/integration/aws-ec2-subnet.yaml
@@ -0,0 +1,19 @@
+Parameters:
+  Vpc:
+    Type: AWS::EC2::VPC::Id
+Resources:
+  Subnet1:
+    Type: AWS::EC2::Subnet
+    Properties:
+      VpcId: !Ref Vpc
+      CidrBlock: 10.0.0.0/24
+      Ipv4NetmaskLength: 10
+  Subnet2:
+    Type: AWS::EC2::Subnet
+    Properties:
+      VpcId: !Ref Vpc
+  Subnet3:
+    Type: AWS::EC2::Subnet
+    Properties:
+      VpcId: !Ref Vpc
+      Ipv4IpamPoolId: test
diff --git a/test/integration/test_integration_templates.py b/test/integration/test_integration_templates.py
index 761ff40f57..4b92d0d4a1 100644
--- a/test/integration/test_integration_templates.py
+++ b/test/integration/test_integration_templates.py
@@ -77,6 +77,13 @@ class TestQuickStartTemplates(BaseCliTestCase):
             ),
             "exit_code": 2,
         },
+        {
+            "filename": ("test/fixtures/templates/integration/aws-ec2-subnet.yaml"),
+            "results_filename": (
+                "test/fixtures/results/integration/aws-ec2-subnet.json"
+            ),
+            "exit_code": 2,
+        },
         {
             "filename": ("test/fixtures/templates/integration/aws-dynamodb-table.yaml"),
             "results_filename": (