Closed battmush closed 1 year ago
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
This issue was automatically closed because of stale in 10 days
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
In attempting to
import
the configuration of an EC2 instance which was provisioned via the AWS EC2 Console, we're running into an issue. The EC2 is created with a static-value private IP address, which creates an ENI under the covers, and sets the 'Delete on termination' param to 'true'. On importing, we first import the network interface, which checking the terraform.tfstate file is correct. Then, we import the EC2 instance, but we end up with an empty array for the value ofnetwork_interface
. The result of this is that any futureplan
for the EC2 target would insist that the instance must be recreated because of perceived differences in the network interface.We were able to resolve this by manually editing the terraform.tfstate file and modifying the
network_interface
, adding the followingThen, modifying the
aws_instance
config fromto
⚠️ Note
Before you submit an issue, please perform the following first:
.terraform
directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/
terraform init
Versions
Reproduction Code [Required]
Steps to reproduce the behavior:
terraform import
of the created ENIterraform import
of the create EC2terraform plan -target
with the EC2 resourceExpected behavior
Expected
network_interface
element to be properly imported Excected the EC2 instance to not require recreationActual behavior
network_interface
element is an empty array EC2 plan always requires recreation without manual editing of .tfstate