> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/tools-terraform/docs/resources/lan.md).

# ionoscloud\_lan

Creates and manages LAN objects.

Manages a **LAN** on IONOS CLOUD.

## Example Usage

```hcl
resource "ionoscloud_datacenter" "example" {
  name                = "Datacenter Example"
  location            = "us/las"
  description         = "Datacenter Description"
  sec_auth_protection = false
}

resource "ionoscloud_private_crossconnect" "example" {
  name                  = "Cross Connect Example"
  description           = "Cross Connect Description"
}

resource "ionoscloud_lan" "example" {
  datacenter_id         = ionoscloud_datacenter.example.id
  public                = false
  name                  = "Lan Example"
  pcc                   = ionoscloud_private_crossconnect.example.id
}
```

## Example Usage With IPv6 Enabled

```hcl
resource "ionoscloud_datacenter" "example" {
  name                  = "Datacenter Example"
  location              = "de/txl"
  description           = "Datacenter Description"
  sec_auth_protection   = false
}

resource "ionoscloud_lan" "example" {
  datacenter_id         = ionoscloud_datacenter.example.id
  public                = true
  name                  = "Lan IPv6 Example"
  ipv6_cidr_block       = "AUTO"
}
```

## Example Usage With a Custom IPv4 CIDR Block

By default, a private LAN gets a /23 block from the `10.0.0.0/8` range. Set `ipv4_cidr_block` to choose the block yourself, e.g. a /24 for general use or a /28 for a small subnet:

```hcl
resource "ionoscloud_datacenter" "example" {
  name                  = "Datacenter Example"
  location              = "de/txl"
  description           = "Datacenter Description"
  sec_auth_protection   = false
}

resource "ionoscloud_lan" "general" {
  datacenter_id         = ionoscloud_datacenter.example.id
  public                = false
  name                  = "Lan /24 Example"
  ipv4_cidr_block       = "10.5.0.0/24"
}

resource "ionoscloud_lan" "small" {
  datacenter_id         = ionoscloud_datacenter.example.id
  public                = false
  name                  = "Lan /28 Example"
  ipv4_cidr_block       = "192.168.42.0/28"
}
```

## Argument reference

* `datacenter_id` - (Required)\[string] The ID of a Virtual Data Center.
* `name` - (Optional)\[string] The name of the LAN.
* `public` - (Optional)\[Boolean] Indicates if the LAN faces the public Internet (true) or not (false).
* `pcc` - (Optional)\[String] The unique id of a `ionoscloud_private_crossconnect` resource, in order. It needs to be ensured that IP addresses of the NICs of all LANs connected to a given Cross Connect is not duplicated and belongs to the same subnet range
* `ipv4_cidr_block` - (Computed, Optional)\[String] The IPv4 CIDR block of a private LAN, e.g. `10.5.0.0/24`. If omitted, a /23 block from the `10.0.0.0/8` range is assigned automatically. A custom block must be within a private RFC 1918 range (`10.0.0.0/8`, `172.16.0.0/12` or `192.168.0.0/16`), have a prefix length between /23 and /28, and be aligned to its prefix boundary (`10.5.0.0/24`, not `10.5.0.1/24`). It can only be set on private LANs. Changing it updates the LAN in place; removing it from the configuration keeps the current block. If the API rejects a block, the error contains the API error code: `536` (not aligned to its prefix boundary), `602` (overlaps a block already in use), `654` (not a private range), `655` (larger than /23) or `656` (set on a public LAN).
* `ipv6_cidr_block` - (Computed, Optional) Contains the LAN's /64 IPv6 CIDR block if this LAN is IPv6 enabled. 'AUTO' will result in enabling this LAN for IPv6 and automatically assign a /64 IPv6 CIDR block to this LAN. If you specify your own IPv6 CIDR block then you must provide a unique /64 block, which is inside the IPv6 CIDR block of the virtual datacenter and unique inside all LANs from this virtual datacenter.
* `ip_failover` - (Computed) IP failover configurations for lan
  * `ip`
  * `nic_uuid`

> **Note:** `terraform plan -generate-config-out` writes one empty `ip_failover {}` block per entry of this computed attribute. The blocks plan as a no-op and can be removed from the generated configuration.

## Import

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

```shell
terraform import ionoscloud_lan.mylandatacenter uuid/lan id
```

## Important Notes

* Please note that only LANs datacenters found in the same physical location can be connected through a Cross-connect
* A LAN cannot be a part of two Cross-connects


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/tools-terraform/docs/resources/lan.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
