[SOLVED] Error: multiple EC2 Instances matched; use additional constraints to reduce matches to a single EC2 Instance
When you are using data sources for aws_instance probably to fetch the IP address or something else, data "aws_instance" "foo" { filter { name = "tag:Name" values = ["instance-name"] } } You must have faced the following issues while using Terraform for EC2 instances. │ Error: multiple EC2 Instances matched; use additional constraints to reduce matches to a single EC2 Instance Why this issue occurs? There’s a fair chance that the previous instance with the same name is destroyed, but there’s still an entry with the terminated state....