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

arvancloud_vpc_elastic_ips (Data Source)

Lists VPC Elastic IPs with optional filtering by VPC ID, region, availability zone, or state.

Example Usage

# List all Elastic IPs.
data "arvancloud_vpc_elastic_ips" "all" {}

output "all_elastic_ips" {
value = data.arvancloud_vpc_elastic_ips.all.elastic_ips
}

# List Elastic IPs in a specific region.
data "arvancloud_vpc_elastic_ips" "ir_central" {
region = "ir-central1"
}

output "ir_central_eip_count" {
value = length(data.arvancloud_vpc_elastic_ips.ir_central.elastic_ips)
}

output "ir_central_eip_addresses" {
value = [for eip in data.arvancloud_vpc_elastic_ips.ir_central.elastic_ips : eip.ip_address]
}

# List Elastic IPs in a specific availability zone.
data "arvancloud_vpc_elastic_ips" "az_a" {
availability_zone = "ir-central1-a"
}

output "az_a_elastic_ips" {
value = data.arvancloud_vpc_elastic_ips.az_a.elastic_ips
}

# Filter Elastic IPs by region.
data "arvancloud_vpc_elastic_ips" "tabriz" {
region = "ir-tabriz1"
}

output "tabriz_eip_details" {
value = {
for eip in data.arvancloud_vpc_elastic_ips.tabriz.elastic_ips : eip.id => {
ip_address = eip.ip_address
availability_zone = eip.availability_zone
created_at = eip.created_at
}
}
}

# Get available Elastic IPs for NAT gateway assignment.
data "arvancloud_vpc_elastic_ips" "available" {
availability_zone = "ir-central1-a"
}

output "available_eips" {
value = [for eip in data.arvancloud_vpc_elastic_ips.available.elastic_ips : {
id = eip.id
ip_address = eip.ip_address
}]
}

Schema

Optional

  • availability_zone (String) Filter elastic IPs by availability zone (e.g., ir-central1-a).
  • region (String) Filter elastic IPs by region (e.g., ir-central1).
  • state (String) Filter elastic IPs by state (e.g., available, up, nat).
  • vpc_id (String) Filter elastic IPs by VPC ID.

Read-Only

  • elastic_ips (Attributes List) List of elastic IPs matching the filter criteria. (see below for nested schema)
  • id (String) Identifier of the datasource.

Nested Schema for elastic_ips

Read-Only:

  • availability_zone (String) Availability zone where the elastic IP is located.
  • created_at (String) Timestamp when the elastic IP was created.
  • device_id (String) ID of the device 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.
  • private_ip_address (String) Private IP address when attached to an instance.
  • public_ip_address (String) Public IP address of the elastic IP.
  • region (String) Region where the elastic IP is located.
  • state (String) Current state of the elastic IP.
  • vpc_id (String) ID of the VPC this elastic IP belongs to.