# ionoscloud\_natgateway

The **NAT gateway data source** can be used to search for and return existing NAT Gateways. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

## Example Usage

### By ID

```hcl
data "ionoscloud_natgateway" "example" {
  datacenter_id = "datacenter_id"
  id			= "nat_gateway_id"
}
```

### By Name

```hcl
data "ionoscloud_natgateway" "example" {
  datacenter_id = "datacenter_id"
  name			= "NAT Gateway Example"
}
```

## Argument Reference

* `datacenter_id` - (Required) Datacenter's UUID.
* `name` - (Optional) Name of an existing network load balancer forwarding rule that you want to search for.
* `id` - (Optional) ID of the network load balancer forwarding rule you want to search for.

`datacenter_id` and either `name` or `id` must be provided. If none, or both of `name` and `id` are provided, the datasource will return an error.

## Attributes Reference

The following attributes are returned by the datasource:

* `id` - Id of that natgateway
* `name` - Name of that natgateway
* `public_ips` - Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location
* `lans` - Collection of LANs connected to the NAT gateway. IPs must contain valid subnet mask. If user will not provide any IP then system will generate an IP with /24 subnet.
  * `id` - Id for the LAN connected to the NAT gateway
  * `gateway_ips` - Collection of gateway IP addresses of the NAT gateway. Will be auto-generated if not provided. Should ideally be an IP belonging to the same subnet as the LAN


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/terraform-provider/data-sources/natgateway.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
