This repository has been archived by the owner on May 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
cloudinit.tf
50 lines (41 loc) · 1.7 KB
/
cloudinit.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
46
47
48
49
50
data "template_file" "cloud-init" {
count = "${var.cluster_size}"
template = "${file("${path.module}/cloudinit/userdata-template.json")}"
vars {
environment = "${var.environment}"
role = "${var.role}"
region = "${var.region}"
etcd_member_unit = "${element(data.template_file.etcd_member_unit.*.rendered, count.index)}"
etcd_bootstrap_unit = "${element(data.template_file.etcd_bootstrap_unit.*.rendered, count.index)}"
ntpdate_unit = "${data.template_file.ntpdate_unit.rendered}"
ntpdate_timer_unit = "${data.template_file.ntpdate_timer_unit.rendered}"
}
}
data "template_file" "etcd_member_unit" {
count = "${var.cluster_size}"
template = "${file("${path.module}/cloudinit/etcd_member_unit")}"
vars {
peer_name = "peer-${count.index}"
discovery_domain_name = "${var.role}.${var.region}.i.${var.environment}.${var.dns["domain_name"]}"
cluster_name = "${var.role}"
}
}
data "template_file" "etcd_bootstrap_unit" {
count = "${var.cluster_size}"
template = "${file("${path.module}/cloudinit/etcd_bootstrap_unit")}"
vars {
region = "${var.region}"
peer_name = "peer-${count.index}"
discovery_domain_name = "${var.role}.${var.region}.i.${var.environment}.${var.dns["domain_name"]}"
etcd3_bootstrap_binary_url = "https://${aws_s3_bucket.files.bucket_domain_name}/etcd3-bootstrap-linux-amd64"
}
}
data "template_file" "ntpdate_unit" {
template = "${file("${path.module}/cloudinit/ntpdate_unit")}"
vars {
ntp_host = "${var.ntp_host}"
}
}
data "template_file" "ntpdate_timer_unit" {
template = "${file("${path.module}/cloudinit/ntpdate_timer_unit")}"
}