Skip to content

Data Source: aws_eip#

Provides information about an Elastic IP (EIP).

Example usage#

Search by allocation ID#

data "aws_eip" "selected" {
  id = "eipalloc-12345678"
}

Search by filters#

data "aws_eip" "selected" {
  filter {
    name   = "tag:Name"
    values = ["tf-eip"]
  }
}

Search by the EIP address#

data "aws_eip" "selected" {
  public_ip = "1.2.3.4"
}

Search by tags#

data "aws_eip" "selected" {
  tags = {
    Name = "tf-eip"
  }
}

Argument reference#

The arguments of this data source act as filters for querying the available EIPs. The given filters must match exactly one EIP whose data will be exported as attributes.

  • filter - (Optional, Block) One or more name/value pairs to use as filters.
  • id - (Optional, String) The allocation ID of the specific EIP to retrieve.
  • public_ip - (Optional, String) The address of the specific EIP to retrieve.
  • tags - (Optional, Map of strings) Key-value pairs. Must exactly match pairs on the required resource.

filter#

  • name - (Required, String) The name of the filter.
    • Constraints: Filter names are case-sensitive
  • values - (Required, List of strings) One or more filter values.
    • Constraints: Filter values are case-sensitive

Attribute reference#

Supported attributes#

In addition to all arguments above, the following attributes are exported:

  • association_id - (String) The ID of the address association with an instance.
    • Constraints: Empty unless the EIP is attached to an instance or a network interface
  • domain - (String) The domain in which the EIP is used.
    • Valid values: vpc
  • instance_id - (String) The ID of the instance that the address is associated with.
    • Constraints: Empty unless the EIP is attached to an instance
  • network_interface_id - (String) The ID of the network interface.
    • Constraints: Empty unless the EIP is attached to an instance or a network interface
  • network_interface_owner_id - (String) The ID of the project that the network interface belongs to.
    • Constraints: Empty unless the EIP is attached to an instance or a network interface
  • private_dns - (String) The private DNS name of the network interface this EIP is attached to.
    • Constraints: Empty unless the EIP is attached to an instance or a network interface
  • private_ip - (String) The private IP address.
    • Constraints: Empty unless the EIP is attached to an instance or a network interface
  • public_dns - (String) The public DNS name of the network interface this EIP is attached to.
    • Constraints: Empty unless the EIP is attached to an instance or a network interface
  • public_ipv4_pool - (String) The ID of the EC2 IPv4 address pool.

Unsupported attributes#

~> Note These attributes may be present in the terraform.tfstate file, but they have preset values and cannot be specified in configuration files.

The following attributes are not currently supported:

carrier_ip, customer_owned_ip, customer_owned_ipv4_pool.