resource "aws_network_interface_attachment" doesnt support import

Viewed 61

I am trying to build a network interface that can move between two different EC2 instances. Because of that, I can't put the EC2 instance ID in the aws_network_interface as is suggested here because this creates a chicken and egg problem and throws a cycle error. Thus I have to use a aws_network_interface_attachment resource to link them together.

The issue is that when the network interface moves to the new EC2, there appears to be no way to get Terraform back in sync without detaching the eni and letting Terraform re-attach it to the new instance since resource "aws_network_interface_attachment" doesn't support import.

Is there a workaround for this without hacking the terraform state file to replace the AttachmentId with the new value?

0 Answers
Related