> 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/private_crossconnect.md).

# ionoscloud\_private\_crossconnect

Creates and manages Cross Connections between virtual datacenters.

Manages a [Cross Connect](https://docs.ionos.com/cloud/network-services/cross-connect/overview) on IONOS CLOUD. Cross Connect allows you to connect virtual data centers (VDC) with each other using a private LAN. The VDCs to be connected need to belong to the same IONOS CLOUD contract and location. You can only use private LANs for a Cross Connect connection. A LAN can only be a part of one Cross Connect.

The IP addresses of the NICs used for the Cross Connect connection may not be used in more than one NIC and they need to belong to the same IP range.

## Example Usage

To connect two datacenters we need 2 lans defined, one in each datacenter. After, we reference the cross-connect through which we want the connection to be established.

```hcl
resource ionoscloud_private_crossconnect CrossConnectTestResource {
  name        = "CrossConnectTestResource"
  description = "CrossConnectTestResource"
}

resource ionoscloud_datacenter dc1 {
  location = "de/txl"
  name = "dc1"
}

resource ionoscloud_datacenter dc2 {
  location = "de/txl"
  name = "dc2"
}

resource ionoscloud_lan dc1lan {
  datacenter_id = ionoscloud_datacenter.dc1.id
  public = false
  name = "dc1lan"
  pcc = ionoscloud_private_crossconnect.CrossConnectTestResource.id
}

resource ionoscloud_lan dc2lan {
  datacenter_id = ionoscloud_datacenter.dc2.id
  public = false
  name = "dc2lan"
  pcc = ionoscloud_private_crossconnect.CrossConnectTestResource.id
}
```

## Argument Reference

The following arguments are supported:

* `name` - (Required)\[string] The name of the cross-connection.
* `description` - (Optional)\[string] A short description for the cross-connection.
* `connectable datacenters` - (Computed) A list containing all the connectable datacenters
  * `id` - The UUID of the connectable datacenter
  * `name` - The name of the connectable datacenter
  * `location` - The physical location of the connectable datacenter
* `peers` - (Computed) Lists LAN's joined to this cross connect
  * `lan_id` - The id of the cross-connected LAN
  * `lan_name` - The name of the cross-connected LAN
  * `datacenter_id` - The id of the cross-connected datacenter
  * `datacenter_name` - The name of the cross-connected datacenter
  * `location` - The location of the cross-connected datacenter

## Import

A Cross Connect resource can be imported using its `resource id`, e.g.

```shell
terraform import ionoscloud_private_crossconnect.demo ionoscloud_private_crossconnect_uuid
```

This can be helpful when you want to import cross-connects which you have already created manually or using other means, outside of terraform.


---

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