2018-12-17 17:40:09 +00:00
|
|
|
resource "aws_instance" "server" {
|
2020-10-28 16:58:00 +00:00
|
|
|
ami = data.aws_ami.ubuntu_bionic_amd64.image_id
|
2019-10-14 15:27:08 +00:00
|
|
|
instance_type = var.instance_type
|
|
|
|
key_name = module.keys.key_name
|
|
|
|
vpc_security_group_ids = [aws_security_group.primary.id]
|
|
|
|
count = var.server_count
|
2020-08-18 18:24:34 +00:00
|
|
|
iam_instance_profile = data.aws_iam_instance_profile.nomad_e2e_cluster.name
|
2020-03-04 15:44:51 +00:00
|
|
|
availability_zone = var.availability_zone
|
2018-12-17 17:40:09 +00:00
|
|
|
|
2020-08-20 14:09:31 +00:00
|
|
|
user_data = file("${path.root}/userdata/ubuntu-bionic.sh")
|
|
|
|
|
2018-12-17 17:40:09 +00:00
|
|
|
# Instance tags
|
2019-10-14 15:27:08 +00:00
|
|
|
tags = {
|
2018-12-17 17:40:09 +00:00
|
|
|
Name = "${local.random_name}-server-${count.index}"
|
|
|
|
ConsulAutoJoin = "auto-join"
|
2019-10-14 15:27:08 +00:00
|
|
|
SHA = var.nomad_sha
|
|
|
|
User = data.aws_caller_identity.current.arn
|
2018-12-17 17:40:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-28 16:58:00 +00:00
|
|
|
resource "aws_instance" "client_ubuntu_bionic_amd64" {
|
|
|
|
ami = data.aws_ami.ubuntu_bionic_amd64.image_id
|
2019-10-14 15:27:08 +00:00
|
|
|
instance_type = var.instance_type
|
|
|
|
key_name = module.keys.key_name
|
|
|
|
vpc_security_group_ids = [aws_security_group.primary.id]
|
2020-10-28 16:58:00 +00:00
|
|
|
count = var.client_count_ubuntu_bionic_amd64
|
2020-08-18 18:24:34 +00:00
|
|
|
iam_instance_profile = data.aws_iam_instance_profile.nomad_e2e_cluster.name
|
2020-03-04 15:44:51 +00:00
|
|
|
availability_zone = var.availability_zone
|
2018-12-17 17:40:09 +00:00
|
|
|
|
2020-08-20 14:09:31 +00:00
|
|
|
user_data = file("${path.root}/userdata/ubuntu-bionic.sh")
|
|
|
|
|
2018-12-17 17:40:09 +00:00
|
|
|
# Instance tags
|
2019-10-14 15:27:08 +00:00
|
|
|
tags = {
|
2020-10-28 16:58:00 +00:00
|
|
|
Name = "${local.random_name}-client-ubuntu-bionic-amd64-${count.index}"
|
2018-12-17 17:40:09 +00:00
|
|
|
ConsulAutoJoin = "auto-join"
|
2019-10-14 15:27:08 +00:00
|
|
|
SHA = var.nomad_sha
|
|
|
|
User = data.aws_caller_identity.current.arn
|
2018-12-17 17:40:09 +00:00
|
|
|
}
|
2019-11-19 16:06:10 +00:00
|
|
|
}
|
|
|
|
|
2020-10-28 16:58:00 +00:00
|
|
|
resource "aws_instance" "client_windows_2016_amd64" {
|
|
|
|
ami = data.aws_ami.windows_2016_amd64.image_id
|
2019-11-19 16:06:10 +00:00
|
|
|
instance_type = var.instance_type
|
|
|
|
key_name = module.keys.key_name
|
|
|
|
vpc_security_group_ids = [aws_security_group.primary.id]
|
2020-10-28 16:58:00 +00:00
|
|
|
count = var.client_count_windows_2016_amd64
|
2020-08-18 18:24:34 +00:00
|
|
|
iam_instance_profile = data.aws_iam_instance_profile.nomad_e2e_cluster.name
|
2020-03-04 15:44:51 +00:00
|
|
|
availability_zone = var.availability_zone
|
2019-11-19 16:06:10 +00:00
|
|
|
|
2020-08-20 14:09:31 +00:00
|
|
|
user_data = file("${path.root}/userdata/windows-2016.ps1")
|
|
|
|
|
2019-11-19 16:06:10 +00:00
|
|
|
# Instance tags
|
|
|
|
tags = {
|
2020-10-28 16:58:00 +00:00
|
|
|
Name = "${local.random_name}-client-windows-2016-${count.index}"
|
2019-11-19 16:06:10 +00:00
|
|
|
ConsulAutoJoin = "auto-join"
|
2020-01-22 13:48:52 +00:00
|
|
|
SHA = var.nomad_sha
|
|
|
|
User = data.aws_caller_identity.current.arn
|
2019-11-19 16:06:10 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-26 21:00:36 +00:00
|
|
|
|
2020-10-28 16:58:00 +00:00
|
|
|
data "aws_ami" "ubuntu_bionic_amd64" {
|
2020-08-26 21:00:36 +00:00
|
|
|
most_recent = true
|
|
|
|
owners = ["self"]
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "name"
|
2020-10-28 16:58:00 +00:00
|
|
|
values = ["nomad-e2e-ubuntu-bionic-amd64-*"]
|
2020-08-26 21:00:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "tag:OS"
|
|
|
|
values = ["Ubuntu"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-28 16:58:00 +00:00
|
|
|
data "aws_ami" "windows_2016_amd64" {
|
2020-08-26 21:00:36 +00:00
|
|
|
most_recent = true
|
|
|
|
owners = ["self"]
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "name"
|
2020-10-28 16:58:00 +00:00
|
|
|
values = ["nomad-e2e-windows-2016-amd64-*"]
|
2020-08-26 21:00:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "tag:OS"
|
|
|
|
values = ["Windows2016"]
|
|
|
|
}
|
|
|
|
}
|