Lab: Terraform Import Q10

Let us fix that now. Complete the resource block for jade-mw. Inspect the state to make sure all the arguments used to create this resource are defined in the resource block.

If unsure, run terraform apply after filling in the arguments and correct them until a plan shows no changes to apply.

resource “aws_instance” “jade-mw” {
ami = “ami-082b3eca746b12a89”
instance_type = “t2.nano”
}
error : The instance type of the ec2 instance called jade-mw has been tampered with! Fix it!
there is no instance jade-mw in .tfstate file
please provide ans with video

Hi @shashwatshah101293,
Thanks for highlighting this. I will look into this.

Regards,

1 Like

In 8th question,
After importing through the terraform import command. I can see the details in the terraform.tfstate file.

terraform show -json | jq -r '.values.root_module.resources[] | select(.type == "aws_instance" and .name == "jade-mw")'

after this now The tag called Name for the instance called jade-mw has been tampered with! Fix it!
error has come
it would be great if you could solve this entire question n post the video of it

Hi @shashwatshah101293,
We have a detailed explanation on the KK GitHub page. Please check it out.

terraform-for-beginners-course/02-terraform-import.md at master · kodekloudhub/terraform-for-beginners-course · GitHub

Regards,

Hi. I use this : resource “aws_instance” “jade-mw” {
ami = “ami-082b3eca746b12a89”
instance_type = “t2.large”
key_name = “jade”
tags = {
Name = “jade-mw”
}
}.
Still getting diff after running terraform plan and no - “nothing to add”