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

# ionoscloud\_ipfailover

Creates and manages ipfailover objects.

Manages **IP Failover** groups 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_ipblock" "example" {
  location              = "us/las"
  size                  = 1
  name                  = "IP Block Example"
}

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

resource "ionoscloud_server" "example" {
  name                  = "Server Example"
  datacenter_id         = ionoscloud_datacenter.example.id
  cores                 = 1
  ram                   = 1024
  image_name            = "Ubuntu-20.04"
  image_password        = random_password.server_image_password.result
  volume {
    name                = "system"
    size                = 14
    disk_type           = "SSD"
  }
  nic {
    lan                 = "1"
    dhcp                = true
    firewall_active     = true
    ips                 = [ ionoscloud_ipblock.example.ips[0] ]
  }
}

resource "ionoscloud_ipfailover" "example" {
  depends_on            = [ ionoscloud_lan.example ]
  datacenter_id         = ionoscloud_datacenter.example.id
  lan_id                = ionoscloud_lan.example.id
  ip                    = ionoscloud_ipblock.example.ips[0]
  nicuuid               = ionoscloud_server.example.primary_nic
}
resource "random_password" "server_image_password" {
  length           = 16
  special          = false
}
```

## Argument reference

* `datacenter_id` - (Required)\[string] The ID of a Virtual Data Center.
* `ip` - (Required)\[string] The reserved IP address to be used in the IP failover group.
* `lan_id` - (Required)\[string] The ID of a LAN.
* `nicuuid` - (Required)\[string] The ID of a NIC.

> **⚠ WARNING:** Do not modify the IP for an IP failover group (that was provisioned via Terraform) using the DCD, the API or other means because it may lead to unexpected behavior. If you provisioned an IP failover group using Terraform, please use only Terraform in order to manage the created IP failover group.

> **⚠ WARNING:** For creating multiple IP failover groups at the same time, you can use one of the following options:

1. Create multiple IP failover groups resources and use `depends_on` meta-argument to specify the order of creation, for example:

```example
resource "ionoscloud_ipfailover" "firstexample" {
  datacenter_id         = "datacenter ID"
  lan_id                = "LAN ID"
  ip                    = "IP address"
  nicuuid               = "NIC UUID"
}

 resource "ionoscloud_ipfailover" "secondexample" {
   depends_on = [ ionoscloud_ipfailover.firstexample ]
   datacenter_id         = "datacenter ID"
   lan_id                = "LAN ID"
   ip                    = "IP address"
   nicuuid               = "NIC UUID"
 }
```

2. Define the resources as presented above, but without using the `depends_on` meta-argument and run the apply command using `-parallelism=1` as presented below:

```shell
terraform apply -parallelism=1
```

## Import

Resource IpFailover can be imported using the `datacenter id`, `lan id` and `ip address`, e.g.

```shell
terraform import ionoscloud_ipfailover.myipfailover datacenter_uuid/lan_uuid/ip_address
```

The IP address may be an IPv4 or an IPv6 address, e.g. `datacenter_uuid/1/2001:db8::10`.

## A note on multiple NICs on an IP Failover

If you want to add a secondary NIC to an IP Failover, follow these steps:

1. Creating NIC A with failover IP on LAN 1
2. Create NIC B unde the same LAN but with a different IP
3. Create the IP Failover on LAN 1 with NIC A and failover IP of NIC A (A becomes now "master", no slaves)
4. Update NIC B IP to be the failover IP ( B becomes now a slave, A remains master)

After this you can create a new NIC C, NIC D and so on, in LAN 1, directly with the failover IP.

Please check [examples](https://docs.ionos.com/cloud/tools-terraform/examples/ip_failover.md) for a full example with the above steps.


---

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