I have a snippet of a script that deployed EC2’s with a few EIP’s. See below:
resource “aws_eip” “management” {
count = length(var.palos)
vpc = true
network_interface = aws_network_interface.management[count.index].id
tags = {
Name = “${var.palos[count.index].hostname}-management”
}
}
Create eth1 elastic IPs
resource “aws_eip” “eth1” {
count = length(var.palos)
vpc = true
network_interface = aws_network_interface.eth1[count.index].id
tags = {
Name = “${var.palos[count.index].hostname}-eth1”
}
}
Create Palo instances
resource “aws_instance” “palo_vm” {
count = length(var.palos)
ami = var.ami
availability_zone = var.palos[count.index].az
ebs_optimized = true
root_block_device {
delete_on_termination = true
encrypted = true
volume_size = 60
volume_type = “gp3”
}
iam_instance_profile = aws_iam_instance_profile.palo_vm.id
instance_type = var.instance_size
network_interface {
device_index = 0
network_interface_id = aws_network_interface.management[count.index].id
}
network_interface {
device_index = 1
network_interface_id = aws_network_interface.eth1[count.index].id
}
network_interface {
device_index = 2
network_interface_id = aws_network_interface.eth2[count.index].id
}
user_data = “vmseries-bootstrap-aws-s3bucket=${module.bootstrap_bucket[count.index].id}”
key_name = “${var.palos[count.index].key_pair}”
tags = {
Name = “${var.palos[count.index].hostname}”
}
}
This worked up until about two weeks ago when AWS deprecated some of the classic networking features. See EC2-Classic Networking is Retiring – Here’s How to Prepare | AWS News Blog
Now when we try to execute the script we are getting this error:
│ Error: with the retirement of EC2-Classic no new non-VPC EC2 EIPs can be created
│
│ with module.palo_vm.aws_eip.management[0],
│ on .terraform/modules/palo_vm/aws/palo_vm/main.tf line 281, in resource “aws_eip” “management”:
│ 281: resource “aws_eip” “management” {
I have been trying to see what the correct modifications would need to be in order to deploy the script given th AWS changes. Any thoughts?