mirror of
https://github.com/puppetmaster/typhoon.git
synced 2024-12-26 07:29:32 +01:00
0e71f7e565
* Updating the `terraform-provider-ct` plugin is known to produce a `user_data` diff in all pre-existing clusters. Applying the diff to pre-existing cluster destroys controller nodes * Ignore changes to controller `user_data`. Once all managed clusters use a release containing this change, it is possible to update the `terraform-provider-ct` plugin (worker `user_data` will still be modified) * Changing the module `ref` for an existing cluster and re-applying is still NOT supported (although this PR would protect controllers from being destroyed)
67 lines
1.6 KiB
HCL
67 lines
1.6 KiB
HCL
# Worker DNS records
|
|
resource "digitalocean_record" "workers-record-a" {
|
|
count = "${var.worker_count}"
|
|
|
|
# DNS zone where record should be created
|
|
domain = "${var.dns_zone}"
|
|
|
|
name = "${var.cluster_name}-workers"
|
|
type = "A"
|
|
ttl = 300
|
|
value = "${element(digitalocean_droplet.workers.*.ipv4_address, count.index)}"
|
|
}
|
|
|
|
resource "digitalocean_record" "workers-record-aaaa" {
|
|
count = "${var.worker_count}"
|
|
|
|
# DNS zone where record should be created
|
|
domain = "${var.dns_zone}"
|
|
|
|
name = "${var.cluster_name}-workers"
|
|
type = "AAAA"
|
|
ttl = 300
|
|
value = "${element(digitalocean_droplet.workers.*.ipv6_address, count.index)}"
|
|
}
|
|
|
|
# Worker droplet instances
|
|
resource "digitalocean_droplet" "workers" {
|
|
count = "${var.worker_count}"
|
|
|
|
name = "${var.cluster_name}-worker-${count.index}"
|
|
region = "${var.region}"
|
|
|
|
image = "${var.image}"
|
|
size = "${var.worker_type}"
|
|
|
|
# network
|
|
ipv6 = true
|
|
private_networking = true
|
|
|
|
user_data = "${data.template_file.worker-cloudinit.rendered}"
|
|
ssh_keys = ["${var.ssh_fingerprints}"]
|
|
|
|
tags = [
|
|
"${digitalocean_tag.workers.id}",
|
|
]
|
|
|
|
lifecycle {
|
|
create_before_destroy = true
|
|
}
|
|
}
|
|
|
|
# Tag to label workers
|
|
resource "digitalocean_tag" "workers" {
|
|
name = "${var.cluster_name}-worker"
|
|
}
|
|
|
|
# Worker Cloud-Init
|
|
data "template_file" "worker-cloudinit" {
|
|
template = "${file("${path.module}/cloudinit/worker.yaml.tmpl")}"
|
|
|
|
vars = {
|
|
ssh_authorized_key = "${var.ssh_authorized_key}"
|
|
k8s_dns_service_ip = "${cidrhost(var.service_cidr, 10)}"
|
|
cluster_domain_suffix = "${var.cluster_domain_suffix}"
|
|
}
|
|
}
|