-
Notifications
You must be signed in to change notification settings - Fork 3
/
_instance-master.tf
38 lines (31 loc) · 1.25 KB
/
_instance-master.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
data "template_file" "k8s-master" {
template = "${file("assets/cloud-config/master/cloud-config.yml")}"
vars {
ETCD_ENDPOINTS = "${join(",", formatlist("http://%s:%s", aws_instance.k8s-etcd.*.private_ip, "2379") ) }"
discovery_url = "${file("assets/discovery/etcd_discovery_url.txt")}"
tls-root-ca = "${file("assets/tls/ca.pem")}"
tls-apiserver = "${file("assets/tls/apiserver.pem")}"
tls-apiserver-key = "${file("assets/tls/apiserver-key.pem")}"
}
}
resource "aws_instance" "k8s-master" {
count = "1"
ami = "${lookup(var.amis, var.region)}"
instance_type = "t2.medium"
subnet_id = "${aws_subnet.k8s-public.id}"
key_name = "${var.aws_key_name}"
private_ip = "${var.subnet_prefix}${var.master_ip_suffix}"
user_data = "${data.template_file.k8s-master.rendered}"
associate_public_ip_address = true
iam_instance_profile = "${aws_iam_instance_profile.master_instance_profile.id}"
tags {
Name = "k8s-master"
}
vpc_security_group_ids = [
"${aws_security_group.k8s-master.id}",
]
depends_on = [
"aws_instance.k8s-etcd",
"null_resource.generate-tls",
]
}