Hi Team,
i am creating 3 instances using for_each and toset in my resource code block.
However how can i create only one instance out of the three instances provisioned with ansible/httpd using user_data or remote_exec.
main.tf as below.
resource "aws_instance" "demo-server" {
ami = "ami-053b0d53c279acc90"
instance_type = "t2.micro"
key_name = "sshkey"
vpc_security_group_ids = [aws_security_group.demo-sg.id]
subnet_id = aws_subnet.dpw-public_subent_01.id
for_each = toset(["Jenkins-master","Jenkins-slave","Ansible"])
tags = {
Name = "${each.key}"
}
}