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

arvancloud_vpc_elastic_ip (Resource)

Manages a VPC Elastic IP that provides a static public IP address for cloud resources.

Example Usage

# Create an Elastic IP in a specific VPC and availability zone.
resource "arvancloud_vpc_elastic_ip" "example" {
vpc_id = arvancloud_vpc.example.id
availability_zone = "ir-central1-a"
}

# Create multiple Elastic IPs in different availability zones.
resource "arvancloud_vpc_elastic_ip" "az_a" {
vpc_id = arvancloud_vpc.app_vpc.id
availability_zone = "ir-central1-a"
}

resource "arvancloud_vpc_elastic_ip" "az_b" {
vpc_id = arvancloud_vpc.app_vpc.id
availability_zone = "ir-central1-b"
}

resource "arvancloud_vpc_elastic_ip" "az_c" {
vpc_id = arvancloud_vpc.app_vpc.id
availability_zone = "ir-central1-c"
}

# Output Elastic IP attributes.
output "example_eip_id" {
value = arvancloud_vpc_elastic_ip.example.id
}

output "example_eip_address" {
value = arvancloud_vpc_elastic_ip.example.ip_address
}

output "example_eip_region" {
value = arvancloud_vpc_elastic_ip.example.region
}

output "example_eip_az" {
value = arvancloud_vpc_elastic_ip.example.availability_zone
}

output "example_eip_created_at" {
value = arvancloud_vpc_elastic_ip.example.created_at
}

Schema

Required

  • availability_zone (String) Availability zone where the elastic IP will be created (e.g., ir-central1-a). Changing this value forces a new resource to be created.
  • vpc_id (String) ID of the VPC this elastic IP belongs to. Changing this value forces a new resource to be created.

Read-Only

  • created_at (String) Timestamp when the elastic IP was created.
  • device_id (String) ID of the device (instance or NAT gateway) the elastic IP is attached to.
  • device_name (String) Name of the device the elastic IP is attached to.
  • id (String) Unique identifier (allocation ID) of the elastic IP assigned by the API.
  • private_ip_address (String) Private IP address when attached to an instance.
  • public_ip_address (String) Public IP address assigned to the elastic IP.
  • region (String) Region where the elastic IP is located.
  • state (String) Current state of the elastic IP (e.g., available, up, nat).

Import

Import is supported using the following syntax:

terraform import arvancloud_vpc_elastic_ip.example eip-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx