# ionoscloud\_nic

The **Nic data source** can be used to search for and return existing nics. 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_nic" "example" {
  datacenter_id   = "datancenter_id"
  server_id       = "server_id"
  id			  = "nic_id"
}
```

### By Name

```hcl
data "ionoscloud_nic" "example" {
  datacenter_id   = "datancenter_id"
  server_id       = "server_id"
  name            = "Nic Example"
}
```

## Argument reference

* `datacenter_id` - (Required)\[string] The ID of a Virtual Data Center.
* `server_id` - (Required)\[string] The ID of a server.
* `name` - (Optional)\[string] The name of the LAN.
* `id` - (Optional) ID of the nic you want to search for.

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

## Import

Resource Nic can be imported using the `resource id`, e.g.

## Attributes Reference

The following attributes are returned by the datasource:

* `id` - The id of the NIC.
* `datacenter_id` - The ID of a Virtual Data Center.
* `server_id` - The ID of a server.
* `lan` - The LAN ID the NIC will sit on.
* `name` - The name of the LAN.
* `dhcp` - Indicates if the NIC should get an IP address using DHCP (true) or not (false).
* `ips` - Collection of IP addresses assigned to a nic. Explicitly assigned public IPs need to come from reserved IP blocks, Passing value null or empty array will assign an IP address automatically.
* `firewall_active` - If this resource is set to true and is nested under a server resource firewall, with open SSH port, resource must be nested under the NIC.
* `firewall_type` - The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the default value INGRESS
* `mac` - The MAC address of the NIC.
* `device_number`- The Logical Unit Number (LUN) of the storage volume. Null if this NIC was created from CloudAPI and no DCD changes were done on the Datacenter.
* `pci_slot`- The PCI slot number of the Nic.
* `flowlog` - Only 1 flow log can be configured. Only the name field can change as part of an update. Flow logs holistically capture network information such as source and destination IP addresses, source and destination ports, number of packets, amount of bytes, the start and end time of the recording, and the type of protocol – and log the extent to which your instances are being accessed.
  * `action` - Specifies the action to be taken when the rule is matched. Possible values: ACCEPTED, REJECTED, ALL.
  * `bucket` - Specifies the IONOS Object Storage bucket where the flow log data will be stored. The bucket must exist.
  * `direction` - Specifies the traffic direction pattern. Valid values: INGRESS, EGRESS, BIDIRECTIONAL.
  * `name` - Specifies the name of the flow log.
* `security_groups_ids` - The list of Security Group IDs for the resource.


---

# 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/nic.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.
