I am trying to spin 2 ec2 instances using terraform. Something like this
resource "aws_instance" "example" {
count = "${var.number_of_instances}"
ami = "${var.ami_name}"
associate_public_ip_address = "${var.associate_public_ip_address}"
instance_type = "${var.instance_type}"
key_name = "${var.keyname}"
subnet_id = "${element(var.subnet_ids, count.index)}"
user_data = "${element(data.template_file.example.*.rendered, count.index)}"
vpc_security_group_ids = ["${aws_security_group.example.id}","${var.extra_security_group_id}"]
root_block_device {
volume_size = "${var.root_volume_size}"
volume_type = "${var.root_volume_type}"
iops = "${var.root_volume_iops}"
}
tags {
Name = "${var.prefix}${var.name}${format("%02d", count.index + 1)}"
}
}
In template_file all I am trying to do is to generate a config file with IP Address of both the instances using user_data but this fails saying Cycle Error.
Is there any way to get the file to generate with IP Address while the ec2 instances are coming up
DNSNamething. But I have some stupid logic here in my company where Security won't allow connecting to externalDNSNameon aportanything else443. - devnull