پرش به مطلب اصلی

arvancloud_iaas_floating_ip_attachment (Resource)

Manages the attachment of a floating IP address to a compute server instance. This resource attaches an existing floating IP to a server's network port, making the floating IP accessible from the server. The floating IP must already exist before attaching it.

Example Usage

resource "arvancloud_iaas_network" "foobar_private_network" {
name = "foobar-net"
# other resource fields are hidded to reduce the doc size

}
resource "arvancloud_iaas_server" "foobar_srv" {
name = "foobar-srv"
# other resource fields are hidded to reduce the doc size
}
resource "arvancloud_iaas_network_attachment" "foobar_attachment" {
network_id = arvancloud_iaas_network.foobar_private_network.id
server_id = arvancloud_iaas_server.foobar_srv.id
subnet_id = arvancloud_iaas_network.foobar_private_network.subnet_id
ip_address = "192.168.99.12"
enable_port_security = true
availability_zone = "ir-central1-b"
}

resource "arvancloud_iaas_floating_ip" "fip_for_temp_internet_access" {
availability_zone = "ir-central1-b"
description = "Floating IP for temp internet access to the servers in foobar_private_network"
}

output "fip_for_temp_internet_access_details" {
description = "All supported information for the floating IP with the ID of fip_for_temp_internet_access"
value = (
arvancloud_iaas_floating_ip.fip_for_temp_internet_access
)
}

resource "arvancloud_iaas_floating_ip_attachment" "temp_internet_attach" {
floating_ip_id = arvancloud_iaas_floating_ip.fip_for_temp_internet_access.id
server_id = arvancloud_iaas_server.foobar_srv.id
subnet_id = arvancloud_iaas_network.foobar_private_network.subnet_id
port_id = arvancloud_iaas_network_attachment.foobar_attachment.port_id
availability_zone = "ir-central1-b"
}

Schema

Required

  • availability_zone (String) Availability zone where the floating IP and server reside (e.g., ir-central1-a).
  • floating_ip_id (String) ID of the floating IP to attach.
  • port_id (String) ID of the network port on the server to attach the floating IP to.
  • server_id (String) ID of the compute server instance to attach the floating IP to.
  • subnet_id (String) ID of the subnet where the server's port resides.

Read-Only

  • id (String) Unique identifier for this attachment.
  • region (String) Region where the floating IP and server reside (e.g., ir-central1).
  • status (String) Status of the floating IP after attachment.

Import

Import is supported using the following syntax:

terraform import arvancloud_iaas_floating_ip_attachment.example "3d4e5f6a-7b8c-9d0e-1f2a-3b4c5d6e7f8a:ab5f9ae1-5c5e-44e2-8923-b11ea5a6e9c2"