Terrform Lab: Import

Im stuck on problem 9.

I tainted the imported instance because it said jade-mw resource was tampered, not sure if it was the right thing to do.

Error message:
Error: Error locking state: Error acquiring the state lock: resource temporarily unavailable
Lock Info:
  ID:        8e4990e3-d2b3-fb41-cbc8-ea625ed6a1c0
  Path:      terraform.tfstate
  Operation: OperationTypeRefresh
  Who:       root@iac-server
  Version:   0.13.3
  Created:   2021-06-26 00:16:37.593656014 +0000 UTC
  Info:      


Terraform acquires a state lock to protect the state from being written
by multiple users at the same time. Please resolve the issue above and try
again. For most commands, you can disable locking with the "-lock=false"
flag, but this is not recommended.
log:
The configuration file not updated correctly. Refer terraform plan and identify the discrepancy
The ami-id of the ec2 instance called jade-mw has been tampered with! Fix it!
The instance type of the ec2 instance called jade-mw has been tampered with! Fix it!
The instance type of the ec2 instance called jade-mw has been tampered with! Fix it!
The tag called Name for the instance called jade-mw has been tampered with! Fix it! 

@stevepaul , You need to update the main.tf file with the instance details until when you run “terraform plan” command it shows

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed

To be more precise, check the terraform state file and fill the details like ami,instance_type,tags and key_name.

Then run terraform plan command to make sure resource is imported correctly.

I’m facing the same issue I have updated and the state file and imported the ec2 resource as per the tutorial not sure what is the issue

resource “aws_instance” “jade-mw” {
ami = “ami-082b3eca746b12a89”
instance_type = “t2.large”
key_name = “jade”
}

I could see the configuration entry for the same in state file

Hi, Try this block
resource “aws_instance” “jade-mw” {

ami = “ami-082b3eca746b12a89”

instance_type = “t2.large”

key_name = “jade”

tags = {

"Name" = "jade-mw"

}