-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworker.tf
35 lines (32 loc) · 1.06 KB
/
worker.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
resource "aws_instance" "cluster-workers" {
count = var.worker_count
ami = data.aws_ami.ubuntu.id
instance_type = var.worker_flavor
tags = {
Name = "${var.cluster_name}-worker-${count.index + 1}",
"Role" = "worker",
"kubernetes.io/cluster/${var.cluster_name}" = "owned",
"Creator" = "[email protected]"
}
key_name = aws_key_pair.cluster-key.key_name
vpc_security_group_ids = [aws_security_group.cluster_allow_ssh.id]
iam_instance_profile = "${var.iam_instance_profile}"
associate_public_ip_address = true
source_dest_check = false
ebs_optimized = true
user_data = <<EOF
#!/bin/bash
# Use full qualified private DNS name for the host name. Kube wants it this way.
HOSTNAME=$(curl http://169.254.169.254/latest/meta-data/hostname)
echo $HOSTNAME > /etc/hostname
sed -i "s|\(127\.0\..\.. *\)localhost|\1$HOSTNAME|" /etc/hosts
hostname $HOSTNAME
EOF
lifecycle {
ignore_changes = [ami]
}
root_block_device {
volume_type = "gp2"
volume_size = 50
}
}