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.2 KiB

  1. # Configure the Packet Provider
  2. provider "packet" {
  3. }
  4. resource "packet_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 "packet_device" "k8s_master" {
  10. depends_on = ["packet_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. facility = "${var.facility}"
  15. operating_system = "${var.operating_system}"
  16. billing_cycle = "${var.billing_cycle}"
  17. project_id = "${var.packet_project_id}"
  18. tags = ["cluster-${var.cluster_name}", "k8s-cluster", "kube-master", "etcd", "kube-node"]
  19. }
  20. resource "packet_device" "k8s_master_no_etcd" {
  21. depends_on = ["packet_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. facility = "${var.facility}"
  26. operating_system = "${var.operating_system}"
  27. billing_cycle = "${var.billing_cycle}"
  28. project_id = "${var.packet_project_id}"
  29. tags = ["cluster-${var.cluster_name}", "k8s-cluster", "kube-master"]
  30. }
  31. resource "packet_device" "k8s_etcd" {
  32. depends_on = ["packet_ssh_key.k8s"]
  33. count = "${var.number_of_etcd}"
  34. hostname = "${var.cluster_name}-etcd-${count.index+1}"
  35. plan = "${var.plan_etcd}"
  36. facility = "${var.facility}"
  37. operating_system = "${var.operating_system}"
  38. billing_cycle = "${var.billing_cycle}"
  39. project_id = "${var.packet_project_id}"
  40. tags = ["cluster-${var.cluster_name}", "etcd"]
  41. }
  42. resource "packet_device" "k8s_node" {
  43. depends_on = ["packet_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. facility = "${var.facility}"
  48. operating_system = "${var.operating_system}"
  49. billing_cycle = "${var.billing_cycle}"
  50. project_id = "${var.packet_project_id}"
  51. tags = ["cluster-${var.cluster_name}", "k8s-cluster", "kube-node"]
  52. }