Salt installer change: standardize on putting the certs directory under
[arvados-dev.git] / jenkins / test-arvados-multinode / terraform / main.tf
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 data "aws_ami" "debian" {
6   most_recent = true
7
8   filter {
9     name   = "name"
10     values = ["debian-11-amd64-*"]
11   }
12
13   filter {
14     name   = "architecture"
15     values = ["x86_64"]
16   }
17
18   # Debian's
19   owners = ["136693071363"]
20 }
21
22 resource "random_password" "cluster_name" {
23   length  = 5
24   upper   = false
25   special = false
26 }
27
28 module "ec2_cluster" {
29   source  = "terraform-aws-modules/ec2-instance/aws"
30   version = "~> 3.5"
31
32   count = var.instances_count
33
34   name = "${var.instance_name_prefix}-${count.index}"
35
36   ami                         = data.aws_ami.debian.id
37   instance_type               = "t3.medium"
38   associate_public_ip_address = true
39   ebs_optimized               = true
40
41   root_block_device = [{
42     encrypted             = true,
43     volume_size           = 50,
44     delete_on_termination = true,
45   }]
46
47   key_name   = var.user_key
48   monitoring = false
49   # These are tordo's SGs
50   vpc_security_group_ids = [
51     "sg-07a8d44b8d75ab8de",
52     "sg-0b36cbad0a62e6154",
53     "sg-0fdce93c95877be0b",
54     "sg-0e8fdd7632926eac6"
55   ]
56   subnet_id = "subnet-05b635657ce13d74e"
57
58   tags = {
59     Name        = "${var.instance_name_prefix}-${count.index}"
60     Terraform   = "true"
61     Environment = "dev"
62     Owner       = "jenkins"
63     Ticket      = var.jenkins_build_tag
64     Cluster     = random_password.cluster_name.result
65   }
66 }