I created a brand new (free) AWS account.
Using terraform, I created an EC2 instance but can't see it in aws console.
My terraform script is very simple
provider "aws" {
region = "us-east-2"
}
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
tags = {
Name = "terraform-example"
}
}
terraform apply
completes successfully but when going to EC2 on the AWS Console, it tells me that there are no instances...
Even if I login as the AWS root account.
Out of curiosity, I created an EC2 instance manually through the AWS Console. I can see this one created manually.
If I run terraform plan
again, it's still says everything is fine...
Should not it try to remove this new manual instance instead?
Does that confirm that my terraform instance is not looking at the account I think it is???
Later, I took the exact same credentials and main.tf
file to another laptop
Initially terraform plan
did not recognise my EC2 (or anything) created before (I suppose this is because i did not copy across the Terraform state file...).
Ran terraform apply
which recreated the items... and this time I can see the instances I create...
Next step: try to find out whether this initial EC2 instance has been created in another region... which I am hoping to find out through billing / or activity...