Skip to content

Commit

Permalink
updates docs for data aws_eip filter
Browse files Browse the repository at this point in the history
  • Loading branch information
richardbowden committed Feb 25, 2018
1 parent ec0a43c commit 10f42ab
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions website/docs/d/eip.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public IP as an input variable and needs to determine the other.
The following example shows how one might accept a public IP as a variable
and use this data source to obtain the allocation ID when using an VPC EIP.

### ip or id
```hcl
variable "instance_id" {}
variable "public_ip" {}
Expand All @@ -32,6 +33,35 @@ resource "aws_eip_association" "proxy_eip" {
}
```

### filter

```hcl
variable "instance_id" {}
resource "aws_eip" "proxy_ip" {
vpc = true
tags {
Name = "proxy"
}
}
data "aws_eip" "by_filter" {
filter {
name = "tag:Name"
values = ["${aws_eip.test.tags.Name}"]
}
}
resource "aws_eip_association" "proxy_eip" {
instance_id = "${var.instance_id}"
allocation_id = "${data.aws_eip.proxy_ip.id}"
}
```

~> **NOTE:** if using `data "aws_eip"` on a none pre exsiting EIP, ensure you reference the tag of the EIP by interpolation as shown in the example.

Classic EIP's do not have an allocation_id, only use `public_ip` in the `data "aws_eip"` block.

## Argument Reference
Expand All @@ -44,6 +74,12 @@ Elastic IP whose data will be exported as attributes.

* `public_ip` - (Optional) The public IP of the specific EIP to retrieve.

* `filter` - (Optional) One or more name/value pairs to use as filters. There are
several valid keys, for a full reference, check out
[describe-addresses in the AWS CLI reference][1].

~> **NOTE:** `filter` cannot be used when `id` or `public_ip` is being used.

## Attributes Reference

All of the argument attributes are also exported as result attributes. This
Expand Down

0 comments on commit 10f42ab

Please sign in to comment.