github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/terraform/compute.tf (about) 1 resource "aws_instance" "server" { 2 ami = data.aws_ami.linux.image_id 3 instance_type = var.instance_type 4 key_name = module.keys.key_name 5 vpc_security_group_ids = [aws_security_group.primary.id] 6 count = var.server_count 7 availability_zone = var.availability_zone 8 9 # Instance tags 10 tags = { 11 Name = "${local.random_name}-server-${count.index}" 12 ConsulAutoJoin = "auto-join" 13 SHA = var.nomad_sha 14 User = data.aws_caller_identity.current.arn 15 } 16 17 iam_instance_profile = aws_iam_instance_profile.instance_profile.name 18 } 19 20 resource "aws_instance" "client_linux" { 21 ami = data.aws_ami.linux.image_id 22 instance_type = var.instance_type 23 key_name = module.keys.key_name 24 vpc_security_group_ids = [aws_security_group.primary.id] 25 count = var.client_count 26 depends_on = [aws_instance.server] 27 availability_zone = var.availability_zone 28 29 # Instance tags 30 tags = { 31 Name = "${local.random_name}-client-${count.index}" 32 ConsulAutoJoin = "auto-join" 33 SHA = var.nomad_sha 34 User = data.aws_caller_identity.current.arn 35 } 36 37 ebs_block_device { 38 device_name = "/dev/xvdd" 39 volume_type = "gp2" 40 volume_size = "50" 41 delete_on_termination = "true" 42 } 43 44 iam_instance_profile = aws_iam_instance_profile.instance_profile.name 45 } 46 47 resource "aws_instance" "client_windows" { 48 ami = data.aws_ami.windows.image_id 49 instance_type = var.instance_type 50 key_name = module.keys.key_name 51 vpc_security_group_ids = [aws_security_group.primary.id] 52 count = var.windows_client_count 53 depends_on = [aws_instance.server] 54 iam_instance_profile = aws_iam_instance_profile.instance_profile.name 55 availability_zone = var.availability_zone 56 57 # Instance tags 58 tags = { 59 Name = "${local.random_name}-client-windows-${count.index}" 60 ConsulAutoJoin = "auto-join" 61 SHA = var.nomad_sha 62 User = data.aws_caller_identity.current.arn 63 } 64 65 ebs_block_device { 66 device_name = "xvdd" 67 volume_type = "gp2" 68 volume_size = "50" 69 delete_on_termination = "true" 70 } 71 72 # We need this userdata script because Windows machines don't 73 # configure ssh with cloud-init by default. 74 user_data = file("${path.root}/shared/config/userdata-windows.ps1") 75 76 }