-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstances.tf
45 lines (38 loc) · 1.38 KB
/
instances.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Demo Ubuntu Server(t2.medium)
resource "aws_instance" "kubernetes_master" {
count = 1
ami = var.kubernetes_ami
instance_type = var.master_instance_type
vpc_security_group_ids = [aws_security_group.kubernetes_sg.id]
subnet_id = element(aws_subnet.kubernetes_subnets.*.id, count.index)
key_name = var.key_name
tags = {
Name = "kubernetes_master"
Type = "kubernetes_master"
}
}
# 2 Instance Of kubernetes worker Servers(t2.micro)
resource "aws_instance" "kubernetes_worker1" {
count = 1
ami = var.kubernetes_ami
instance_type = var.worker_instance_type
vpc_security_group_ids = [aws_security_group.kubernetes_sg.id]
subnet_id = element(aws_subnet.kubernetes_subnets.*.id, count.index)
key_name = var.key_name
tags = {
Name = "kubernetes_worker1"
Type = "kubernetes_worker"
}
}
resource "aws_instance" "kubernetes_worker2" {
count = 1
ami = var.kubernetes_ami
instance_type = var.worker_instance_type
vpc_security_group_ids = [aws_security_group.kubernetes_sg.id]
subnet_id = element(aws_subnet.kubernetes_subnets.*.id, count.index)
key_name = var.key_name
tags = {
Name = "kubernetes_worker2"
Type = "kubernetes_worker"
}
}