terraform apply -replace="aws_instance.webserver[0]"
or
terraform state rm aws_instance.webserver[0] && terraform apply aws_instance.webserver[0]
NOTS:
Replace and Keep the old Resource
One approach that saved me a lot of time was when I needed to replace one resource, but I didn’t want to lose it. So, you may think, why would we like to do it? Imagine if you have some issue with one EC2 instance, and you need to keep that instance running until you have time to troubleshoot what is going wrong with it by checking the logs later.
How do we tell Terraform to replace it but keep the old one?
We can remove it from the terraform state. So, it means that the Terraform will “forget” that this instance exists. So, the next time we execute the planning phase, it will create a new one and not mark that instance to be destroyed because the terraform doesn’t manage that specific instance anymore.