I want to create two ec2 machines with the same userdata. The first ec2 is getting created but the second is failing. The instance profile is same for both. Do you all think that I am missing something obvious ?
resource "aws_instance" "testnode" {
instance_type = "t2.micro"
ami = "ami-0b0af3577fe5e3532"
tags = {
Name = join("-", ["xnode", "test"])
}
iam_instance_profile = aws_iam_instance_profile.test_instance_profile.name
ubnet_id = aws_subnet.test_public_subnet.id
user_data = file("userdata.tpl")
root_block_device {
volume_size = 10
}
I would like to add that even if I add count=2 the first is getting created fine but the second ec2 is getting created without the userdata.