Allocate new static IP and create new instance EC2

Hi!

How to allocate new static ip in Elastic IP with terraform?
How to get this static ip and associate a new EC2 instance

I’m tryed this, but not a same IP

resource “aws_eip” “default” {
instance = “${aws_eip.default.public_ip}”
vpc = true
}

resource “aws_instance” “newserver” {
ami = “${aws_ami.client-ami.id}”
instance_type = “t2.micro”
}

ERROR: Incorrect attribute value type

on snap-to-ec2.tf line 19, in resource “aws_route53_record” “client-dns”:
19: records = aws_eip.default.public_ip
|----------------
| aws_eip.default.public_ip is “18.211.142.50”

Inappropriate value for attribute “records”: set of string required.

In the EIP resource, the parameter instance should point to the EC2 instance, not the EIP itself: instance = aws_instance.newserver.id