Hello,
I have the following code for Terraform 0.11.5:
resource "aws_instance" "worker2_ec2" {
instance_type = "r4.2xlarge"
subnet_id = "${element(split(",", module.public_subnet.subnet_ids), 0)}"
ami = "${lookup(var.worker_ami, var.region)}"
count = 1
key_name = "${var.key_name}"
vpc_security_group_ids = ["${module.sg.sg_id}"]
root_block_device = {
volume_type = "gp2"
volume_size = "${lookup(var.c_drive_size, var.region)}"
delete_on_termination = true
}
ebs_block_device {
device_name = "xvdb"
volume_size = "${lookup(var.d_drive_size, var.region)}"
volume_type = "gp2"
delete_on_termination = true
}
tags = {
created_by = "${var.name}-Terraform"
Name = "${var.name}-Worker2-EC2"
Application = "app1"
Environment = "Production"
}
}
and yesterday instance was created but today when I run terraform plan I have a problem.
Then problem is that TF shows this:
ebs_block_device.3133358816.delete_on_termination: "" => "true" (forces new resource)
ebs_block_device.3133358816.device_name: "" => "xvdb" (forces new resource)
ebs_block_device.3133358816.encrypted: "" => <computed> (forces new resource)
ebs_block_device.3133358816.snapshot_id: "" => <computed> (forces new resource)
ebs_block_device.3133358816.volume_id: "" => <computed>
ebs_block_device.3133358816.volume_size: "" => "100" (forces new resource)
ebs_block_device.3133358816.volume_type: "" => "gp2" (forces new resource)
ebs_block_device.3536824065.delete_on_termination: "true" => "false" (forces new resource)
ebs_block_device.3536824065.device_name: "xvdb" => "" (forces new resource)
Why it's trying to do that? It also doesn't see values for all ebs options.
TF state has correct information but somehow my local stuff doesn't see it.
I did terraform state pull > state.txt and compared with actual stuff in AWS and all looks good.
Can someone explain to me what is happening here?
Thanks,