Reputation: 2384
I have a simple terraform code to create eip.This works fine.
resource "aws_eip" "envoy" {
count = length(var.subnet_cidr_public)
vpc = true
tags = "${merge(map("Name","envoyadmin-${count.index}"),var.tags)}"
}
output "envoy_eip" {
description = "Elastic ip address for Envoy nlb services"
value = aws_eip.envoy.*.allocation_id
}
The problem I have is with the terraform output.Eventhough the eips are created in AWS account, the allocation_ids are shown as null in terraform output. What could be the issue with this and how to fix it?
terraform output
envoy_eip = [
null,
null,
null,
]
Upvotes: 4
Views: 1979
Reputation: 238309
The allocation_id
is actually now provided through id
as explained in the github issue. Thus, you should have:
output "envoy_eip" {
description = "Elastic ip address for Envoy nlb services"
value = aws_eip.envoy.*.id
}
Also this is only id
, not "Elastic ip address" as you wrote in description. For public IP you need to use:
output "envoy_eip" {
description = "Elastic ip address for Envoy nlb services"
value = aws_eip.envoy.*.public_ip
}
Upvotes: 5