Whenever TF is run and the EC2 instance is replaced, it does not contain any public key of a key pair that can be used to connect to the instance.
We need to ensure that everytime an EC2 instance is created/replaced, there is a public key always added so that we don't have to manually add it before we can SSH into the instance.
Whenever TF is run and the EC2 instance is replaced, it does not contain any public key of a key pair that can be used to connect to the instance.
We need to ensure that everytime an EC2 instance is created/replaced, there is a public key always added so that we don't have to manually add it before we can SSH into the instance.
As a start, take a look at this: https://www.terraform.io/docs/providers/aws/r/key_pair.html