resource "tls_private_key" "xfusion-kp" {
algorithm = "RSA"
rsa_bits = 4096
}
resource "aws_key_pair" "xfusion-kp"{
key_name = "xfusion-kp"
public_key = tls_private_key.xfusion-kp.public_key_openssh
}
data "aws_security_group" "default"{
name = "default"
}
resource "aws_instance" "xfusion-ec2" {
ami = "ami-0c101f26f147fa7fd"
instance_type = "t2.micro"
key_name = aws_key_pair.xfusion-kp.key_name
security_groups = [data.aws_security_group.default.id]
tags = {
Name = "xfusion-ec2"
}
}
above is my code
below is my error:
Resources have not been created using 'terraform'.
what Iβm missing here? could you please help on this
