### Create external subnets

To specify what egress IP addresses the gateway can use, you create external
leaf subnets containing those IP addresses. The subnets to be used in a
Cloud NAT gateway are required to be of the `leaf` type, as
described in
[Subnet hierarchy](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/subnets-overview.md.txt#subnet-hierarchy),
and must be in the same project as the gateway. These subnets must
be derived from external subnets (subnets that contain external IP addresses).

For example:

```yaml
apiVersion: ipam.gdc.goog/v1
kind: Subnet
metadata:
  name: external-zone1-root
  namespace: project-1
spec:
  ipv4Request:
    cidr: 203.0.113.0/24
  type: Root
---
apiVersion: ipam.gdc.goog/v1
kind: Subnet
metadata:
  name: subnet-1
  namespace: project-1
spec:
  ipv4Request:
    cidr: 203.0.113.1/32
  type: Leaf
  parentReference:
    Name: external-zone1-root
    Namespace: project-1
---
apiVersion: ipam.gdc.goog/v1
kind: Subnet
metadata:
  name: subnet-2
  namespace: project-1
spec:
  ipv4Request:
    prefixLength: 30
  type: Leaf
  parentReference:
    Name: external-zone1-root
    Namespace: project-1
```