mirror of
https://github.com/puppetmaster/typhoon.git
synced 2024-12-26 04:09:34 +01:00
4a469513dd
* Requires poseidon v0.11+ and Flatcar Linux 3185.0.0+ (action required) * Previously, Flatcar Linux configs have been parsed as Container Linux Configs to Ignition v2.2.0 specs by poseidon/ct * Flatcar Linux starting in 3185.0.0 now supports Ignition v3.x specs (which are rendered from Butane Configs, like Fedora CoreOS) * poseidon/ct v0.11.0 adds support for the flatcar Butane Config variant so that Flatcar Linux can use Ignition v3.x Rel: * [Flatcar Support](https://flatcar-linux.org/docs/latest/provisioning/ignition/specification/#ignition-v3) * [poseidon/ct support](https://github.com/poseidon/terraform-provider-ct/pull/131)
68 lines
1.6 KiB
HCL
68 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 = digitalocean_droplet.workers.*.ipv4_address[count.index]
|
|
}
|
|
|
|
resource "digitalocean_record" "workers-record-aaaa" {
|
|
# only official DigitalOcean images support IPv6
|
|
count = local.is_official_image ? var.worker_count : 0
|
|
|
|
# DNS zone where record should be created
|
|
domain = var.dns_zone
|
|
|
|
name = "${var.cluster_name}-workers"
|
|
type = "AAAA"
|
|
ttl = 300
|
|
value = 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.os_image
|
|
size = var.worker_type
|
|
|
|
# network
|
|
vpc_uuid = digitalocean_vpc.network.id
|
|
# only official DigitalOcean images support IPv6
|
|
ipv6 = local.is_official_image
|
|
|
|
user_data = data.ct_config.worker.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"
|
|
}
|
|
|
|
# Flatcar Linux worker
|
|
data "ct_config" "worker" {
|
|
content = templatefile("${path.module}/butane/worker.yaml", {
|
|
cluster_dns_service_ip = cidrhost(var.service_cidr, 10)
|
|
cluster_domain_suffix = var.cluster_domain_suffix
|
|
})
|
|
strict = true
|
|
snippets = var.worker_snippets
|
|
}
|