Hello
I have two terraform resource: AWS EIP and AWS Security Group. I want that EIP should automatically be whitelisted in the security group.
Since I am using the 0.12 version of Terraform, I thought to avoid using ${..} approach and tried referencing follow in cidr_block with the latest configuration language, however, the following block gives an error:
Error: Invalid operand
on
reference.tf line 19, in resource "aws_security_group" "mysg":
19: cidr_blocks = [aws_eip.lb.public_ip/32]
|----------------
| aws_eip.lb.public_ip is "52.88.235.110"
Unsuitable value for left operand: a number is required.
resource "aws_eip" "lb" {
vpc = true
}
resource "aws_security_group" "mysg" {
name = "terraform-sg"
ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = [aws_eip.lb.public_ip/32]
}
}
When I specify ["${aws_eip.lb.public_ip}/32"], it works perfectly but I want to know is using ${..} the right approach even with 0.12?