You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.1 KiB

  1. # Configure the Equinix Metal Provider
  2. provider "metal" {
  3. }
  4. resource "metal_ssh_key" "k8s" {
  5. count = var.public_key_path != "" ? 1 : 0
  6. name = "kubernetes-${var.cluster_name}"
  7. public_key = chomp(file(var.public_key_path))
  8. }
  9. resource "metal_device" "k8s_master" {
  10. depends_on = [metal_ssh_key.k8s]
  11. count = var.number_of_k8s_masters
  12. hostname = "${var.cluster_name}-k8s-master-${count.index + 1}"
  13. plan = var.plan_k8s_masters
  14. facilities = [var.facility]
  15. operating_system = var.operating_system
  16. billing_cycle = var.billing_cycle
  17. project_id = var.metal_project_id
  18. tags = ["cluster-${var.cluster_name}", "k8s_cluster", "kube_control_plane", "etcd", "kube_node"]
  19. }
  20. resource "metal_device" "k8s_master_no_etcd" {
  21. depends_on = [metal_ssh_key.k8s]
  22. count = var.number_of_k8s_masters_no_etcd
  23. hostname = "${var.cluster_name}-k8s-master-${count.index + 1}"
  24. plan = var.plan_k8s_masters_no_etcd
  25. facilities = [var.facility]
  26. operating_system = var.operating_system
  27. billing_cycle = var.billing_cycle
  28. project_id = var.metal_project_id
  29. tags = ["cluster-${var.cluster_name}", "k8s_cluster", "kube_control_plane"]
  30. }
  31. resource "metal_device" "k8s_etcd" {
  32. depends_on = [metal_ssh_key.k8s]
  33. count = var.number_of_etcd
  34. hostname = "${var.cluster_name}-etcd-${count.index + 1}"
  35. plan = var.plan_etcd
  36. facilities = [var.facility]
  37. operating_system = var.operating_system
  38. billing_cycle = var.billing_cycle
  39. project_id = var.metal_project_id
  40. tags = ["cluster-${var.cluster_name}", "etcd"]
  41. }
  42. resource "metal_device" "k8s_node" {
  43. depends_on = [metal_ssh_key.k8s]
  44. count = var.number_of_k8s_nodes
  45. hostname = "${var.cluster_name}-k8s-node-${count.index + 1}"
  46. plan = var.plan_k8s_nodes
  47. facilities = [var.facility]
  48. operating_system = var.operating_system
  49. billing_cycle = var.billing_cycle
  50. project_id = var.metal_project_id
  51. tags = ["cluster-${var.cluster_name}", "k8s_cluster", "kube_node"]
  52. }