I want to use the aws_eip
terraform
data source to retrieve a list of the Elastic IPs already allocated in my account; I want those that are free, i.e. they have not been associated with any resource.
Here is what I did:
data "aws_eip" "free_elastic_ips" {
filter {
name = "association-id"
values = ["null"]
}
}
The problem is that this errors out:
│ Error: no matching EC2 EIP found
│
│ with data.aws_eip.free_elastic_ips,
│ on main.tf line 38, in data "aws_eip" "free_elastic_ips":
│ 38: data "aws_eip" "free_elastic_ips" {
│
despite the fact that I have free Elastic IPs in my org.
Here is the output of aws ec2 describe-addresses
for one such IP (values scrambled intentionally)
{
"PublicIp": "13.24.111.20",
"AllocationId": "eipalloc-0d7ffe3iktk47aafkc",
"Domain": "vpc",
"PublicIpv4Pool": "amazon",
"NetworkBorderGroup": "us-east-1"
},
e.g.
(and this is just one of them)