Terraform level 2 topic 5

Take a look at this question. This is my main.tf file

data “aws_ami” “amazon_linux” {
most_recent = true
owners = [“amazon”] # Official AWS account alias for Amazon AMIs.

filter {
name = “name”
values = [“amzn2-ami-hvm-*-x86_64-gp2”] # Pattern for Amazon Linux 2 AMI names.
}

filter {
name = “architecture”
values = [“x86_64”]
}
}

resource “aws_instance” “main” {
ami = data.aws_ami.amazon_linux.id
instance_type = “t2.micro”

tags = {
    Name = "datacenter-ec2"
}

}

resource “aws_eip” “main” {
instance = aws_instance.main.id
tags = {
Name = “datacenter-eip”
}
}

And this is my outputs.tf file

output “KKE_instance_name” {
value = aws_instance.main.tags.Name
}

output “KKE_eip” {
value = aws_eip.main.tags.Name
}

Im getting this kind of error~
EIP mismatch: Terraform=datacenter-eip, AWS=127.109.21.242

Even though I checked the instance and eip addresses, both public and private ip matched. I don’t know if i’m wrong or the kodekloud wants something specific.

Thank you for checking

Pasting the HCL code directly into the edit window corrupts it, so could you please use code blocks to paste them in instead? If I have uncorrupted code, I can do more to help you.

Take a look at this screenshot, thank you

Hi @ejcs001

I’ve just checked it, and it’s working properly. Please make sure you’re using the correct outputs.