Terraform aws provider destroy removes ec2 instance from local state without comparing the region #15260
Labels
bug
Addresses a defect in current functionality.
service/ec2
Issues and PRs that pertain to the ec2 service.
I have created an EC2 instance in
us-west-2
. Then I runterraform destroy
providing an incorrect/wrong regionus-west-1
it removes the EC2 instance from local state. while it was in the state kept as in theus-west-2
region.So effectively state is no longer tracking that EC2 instance which was created in
us-west-2
.Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Expected Behavior
The EC2 instance should remain in the local state after destroy for wrong region is executed
Actual Behavior
The EC2 instance was removed from the state
Steps to Reproduce
Here's the
destroybug.tf
Here's the list of commands I executed the important moment is that instance is not displayed when execute
terraform show \cat terraform.tfstate
, while it should as I believe.The text was updated successfully, but these errors were encountered: