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.

57 lines
2.1 KiB

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