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

arvancloud_vpc_elastic_ip_attachment (Resource)

Manages the attachment of an Elastic IP to a server instance, providing static public IP connectivity.

Example Usage

# Attach an Elastic IP to a server instance
resource "arvancloud_vpc_elastic_ip_attachment" "example" {
allocation_id = arvancloud_vpc_elastic_ip.example.id
instance_id = arvancloud_iaas_server.example.id
}

# Attach with specific private IP
resource "arvancloud_vpc_elastic_ip_attachment" "with_private_ip" {
allocation_id = arvancloud_vpc_elastic_ip.example.id
instance_id = arvancloud_iaas_server.example.id
private_ip_address = "10.0.1.10"
}

# Output the public IP
output "elastic_ip_public" {
value = arvancloud_vpc_elastic_ip_attachment.example.public_ip
}

# Output the attachment state
output "elastic_ip_state" {
value = arvancloud_vpc_elastic_ip_attachment.example.state
}

Schema

Required

  • allocation_id (String) Allocation ID of the Elastic IP to attach. Changing this value forces a new resource to be created.
  • instance_id (String) ID of the server instance to attach the Elastic IP to. Changing this value forces a new resource to be created.

Optional

  • private_ip_address (String) Private IP address to associate with the Elastic IP. If not specified, the primary private IP of the instance will be used. Changing this value forces a new resource to be created.

Read-Only

  • id (String) Unique identifier of the attachment (format: {allocation_id}/{instance_id}).
  • public_ip (String) Public IP address of the Elastic IP.
  • state (String) Current state of the Elastic IP attachment.

Import

Import is supported using the following syntax:

# Import an Elastic IP attachment using allocation_id/instance_id format
terraform import arvancloud_vpc_elastic_ip_attachment.example eipalloc-12345678/instance-87654321