testernode.tf 996 B

12345678910111213141516171819202122232425
  1. resource "aws_instance" "tester" {
  2. count = local.tester_count
  3. ami = data.aws_ami.re-ami.id
  4. instance_type = var.tester-node-type
  5. availability_zone = element(var.vpc-azs, count.index)
  6. subnet_id = element(var.vpc-subnets, count.index)
  7. vpc_security_group_ids = [aws_security_group.re.id]
  8. source_dest_check = false
  9. key_name = local.ssh_key
  10. tags = merge({ Name = "RedisEnterprise-${var.vpc-name}-${count.index}" }, var.common-tags)
  11. }
  12. resource "aws_eip" "tester-eip" {
  13. vpc = true
  14. count = local.tester_count
  15. tags = merge({ Name = "${var.vpc-name}-node-eip-${count.index}" }, var.common-tags)
  16. }
  17. resource "aws_eip_association" "tester-eip-assoc" {
  18. count = local.tester_count
  19. instance_id = element(aws_instance.tester.*.id, count.index)
  20. allocation_id = element(aws_eip.tester-eip.*.id, count.index)
  21. depends_on = [aws_instance.tester, aws_eip.tester-eip]
  22. }