---
title: "openstack_networking_floatingip_associate_v2"
description: ""
sidebar_position: 2
---

# openstack\_networking\_floatingip\_associate\_v2

:::info

This instruction is a copy of the official OpenStack Terraform provider documentation in the [Terraform Registry](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs).

:::

Associates a floating IP with a port. This is useful in scenarios where you have a pre-allocated floating IP or cannot use the `openstack_networking_floatingip_v2` resource to create a floating IP.

## Example Usage \{#example-usage}

```hcl
resource "openstack_networking_port_v2" "port_1" {
  network_id = "a5bbd213-e1d3-49b6-aed1-9df60ea94b9a"
}

resource "openstack_networking_floatingip_associate_v2" "fip_1" {
  floating_ip = "1.2.3.4"
  port_id     = openstack_networking_port_v2.port_1.id
}
```

## Argument Reference \{#argument-reference}

The following arguments are supported:

* `region` — (необязательный) регион, in котором необходимо получить V2 Networking client. Клиент для работы with сетью необходим для создания плавающего IP-адреса, который можно использовать with другим сетевым ресурсом, например балансировщиком нагрузки. Если параметр не указан, используется аргумент `region` провайдера. Изменение этого параметра приводит к созданию нового плавающего IP-адреса (который может иметь другой адрес, а может and остаться прежним).

* `floating_ip` - (Required) The IP address of an existing floating IP.

* `port_id` - (Required) ID of an existing port with at least one IP address to associate with this floating IP.

## Attributes Reference \{#attributes-reference}

The following attributes are exported:

* `region` - See Argument Reference above.
* `floating_ip` - See Argument Reference above.
* `port_id` - See Argument Reference above.

## Import \{#import}

Floating IP associations can be imported using the `id` of the floating IP, for example:

```bash
$ terraform import openstack_networking_floatingip_associate_v2.fip 2c7f39f3-702b-48d1-940c-b50384177ee1
```
