Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

76 lignes
1.8 KiB

  1. resource "hcloud_server" "k8s-control" {
  2. count = var.node_count
  3. name = "k8s-control-${count.index}"
  4. image = var.os_type
  5. server_type = var.server_type
  6. location = var.location
  7. labels = {
  8. type = "control"
  9. }
  10. ssh_keys = [hcloud_ssh_key.default.id]
  11. user_data = templatefile(
  12. "user-data.yaml.tpl",
  13. {
  14. ssh_pubkey = file("../ssh-terraform-hetzner.pub")
  15. containerd_version = var.containerd_version
  16. docker_version = var.docker_version
  17. }
  18. )
  19. firewall_ids = [hcloud_firewall.k8s-node.id]
  20. network {
  21. network_id = hcloud_network.k8s-nodes.id
  22. }
  23. connection {
  24. type = "ssh"
  25. user = "root"
  26. host = self.ipv6_address # or ipv4_address if your ISP sucks
  27. private_key = file("../ssh-terraform-hetzner")
  28. }
  29. provisioner "remote-exec" {
  30. inline = [
  31. "cloud-init status --wait"
  32. ]
  33. }
  34. }
  35. resource "hcloud_server" "k8s-worker" {
  36. count = var.node_count
  37. name = "k8s-worker-${count.index}"
  38. image = var.os_type
  39. server_type = var.server_type
  40. location = var.location
  41. labels = {
  42. type = "worker"
  43. }
  44. ssh_keys = [hcloud_ssh_key.default.id]
  45. user_data = templatefile(
  46. "user-data.yaml.tpl",
  47. {
  48. ssh_pubkey = file("../ssh-terraform-hetzner.pub")
  49. containerd_version = var.containerd_version
  50. docker_version = var.docker_version
  51. }
  52. )
  53. firewall_ids = [hcloud_firewall.k8s-node.id]
  54. network {
  55. network_id = hcloud_network.k8s-nodes.id
  56. }
  57. connection {
  58. type = "ssh"
  59. user = "root"
  60. host = self.ipv6_address # or ipv4_address if your ISP sucks
  61. private_key = file("../ssh-terraform-hetzner")
  62. }
  63. provisioner "remote-exec" {
  64. inline = [
  65. "cloud-init status --wait"
  66. ]
  67. }
  68. }