Question About Task

Lab Question

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.

My Question

I was unable to complete this task. Can you explain what was to be done? It was the last question of the last lab under the Terraform Import, Tainting Resources and Deubugging section. I received an error saying that the jade-mw tag’s Name key had been tampered with. I couldn’t see how. I hadn’t given the resource a tag block in the main.tf and the for-each above it loops through the var.name variable and provisions an instance for each string in the list with the details provided. Please explain.

@Jay84 , 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.

resource “aws_instance” “jade-mw” {

ami = “ami-082b3eca746b12a89”

instance_type = “t2.large”

key_name = “jade”

tags = {

"Name" = "jade-mw"

}